YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix: bitwarden extension popup still captured when on sub-views (#2927)
Ansh Grover931db40b6c5e
diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsxindex a7e8fda65..aa51bd1d0 100644--- a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx+++ b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx@@ -221,7 +221,7 @@ const DEFAULT_IGNORED_WINDOWS_IN_ALL_OS = ["Settings","Keepass","Recorder",- "Vaults",+ "vault","OBS Studio","screenpipe",];diff --git a/apps/screenpipe-app-tauri/src-tauri/src/store.rs b/apps/screenpipe-app-tauri/src-tauri/src/store.rsindex 6c0bb6246..aca83c42d 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/store.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/store.rs@@ -553,7 +553,7 @@ impl Default for SettingsStore {"Settings".to_string(),"Keepass".to_string(),"Recorder".to_string(),- "Vaults".to_string(),+ "vault".to_string(),"OBS Studio".to_string(),"screenpipe".to_string(),];diff --git a/crates/screenpipe-a11y/src/platform/windows_uia.rs b/crates/screenpipe-a11y/src/platform/windows_uia.rsindex 6efb390ff..df5f8c197 100644--- a/crates/screenpipe-a11y/src/platform/windows_uia.rs+++ b/crates/screenpipe-a11y/src/platform/windows_uia.rs@@ -1074,51 +1074,17 @@ mod tests {AccessibilityNode {control_type: "Button".to_string(),name: Some("A".to_string()),- automation_id: None,- class_name: None,- value: None,- bounds: None,- is_enabled: true,- is_focused: None,- is_keyboard_focusable: None,- children: vec![],+ ..Default::default()},AccessibilityNode {control_type: "Text".to_string(),name: Some("B".to_string()),- automation_id: None,- class_name: None,- value: None,- bounds: None,- is_enabled: true,- is_focused: None,- is_keyboard_focusable: None,- help_text: None,- is_password: None,- is_selected: None,- is_expanded: None,- accelerator_key: None,- access_key: None,- localized_control_type: None,children: vec![AccessibilityNode {control_type: "Text".to_string(),name: Some("C".to_string()),- automation_id: None,- class_name: None,- value: None,- bounds: None,- is_enabled: true,- is_focused: None,- is_keyboard_focusable: None,- help_text: None,- is_password: None,- is_selected: None,- is_expanded: None,- accelerator_key: None,- access_key: None,- localized_control_type: None,- children: vec![],+ ..Default::default()}],+ ..Default::default()},],};diff --git a/crates/screenpipe-a11y/src/tree/windows.rs b/crates/screenpipe-a11y/src/tree/windows.rsindex de62b6b4e..f45bf84c3 100644--- a/crates/screenpipe-a11y/src/tree/windows.rs+++ b/crates/screenpipe-a11y/src/tree/windows.rs@@ -484,6 +484,24 @@ fn extract_text_from_tree(*hit_ignored_extension = true;return;}++ // Fallback for sub-views where the page title doesn't include the+ // extension brand name (e.g. Bitwarden shows "New Login" for the+ // add-login route). Scan 2 levels of children for any text that+ // matches an ignored pattern — extension UIs always render their+ // brand name visibly somewhere near the top of the tree.+ let is_extension_popup = node+ .value+ .as_deref()+ .map_or(false, |v| v.starts_with("chrome-extension://")+ || v.starts_with("moz-extension://")+ || v.starts_with("ms-browser-extension://"));+ if is_extension_popup+ && extension_subtree_matches_ignored(node, ignored_windows_lower)+ {+ *hit_ignored_extension = true;+ return;+ }}if let Some(ref val) = node.value {let trimmed = val.trim();@@ -566,6 +584,41 @@ fn extract_text_from_tree(}}+/// Scan a chrome-extension:// Document node's subtree (up to 2 levels deep) for+/// any text matching an ignored pattern.+///+/// Chrome extension popups sometimes have page titles that don't include the+/// extension brand name (e.g. Bitwarden shows "New Login" for the add-login+/// route). In that case the top-level Document name check misses it, but the+/// extension's own UI text always contains the brand name ("Bitwarden",+/// "1Password", etc.) a few levels in.+fn extension_subtree_matches_ignored(+ node: &AccessibilityNode,+ ignored_lower: &[String],+) -> bool {+ let matches = |val: &str| {+ let lower = val.to_lowercase();+ ignored_lower.iter().any(|ig| lower.contains(ig.as_str()))+ };++ for child in &node.children {+ if child.name.as_deref().is_some_and(|n| matches(n))+ || child.value.as_deref().is_some_and(|v| matches(v))+ {+ return true;+ }+ // One level deeper+ for grandchild in &child.children {+ if grandchild.name.as_deref().is_some_and(|n| matches(n))+ || grandchild.value.as_deref().is_some_and(|v| matches(v))+ {+ return true;+ }+ }+ }+ false+}+/// Append trimmed text to buffer with newline separator.fn append_text(buffer: &mut String, text: &str) {let trimmed = text.trim();@@ -619,51 +672,25 @@ mod tests {let tree = AccessibilityNode {control_type: "Window".to_string(),name: Some("Test App".to_string()),- automation_id: None,- class_name: None,- value: None,- bounds: None,- is_enabled: true,- is_focused: None,- is_keyboard_focusable: None,children: vec![AccessibilityNode {control_type: "Text".to_string(),name: Some("Hello World".to_string()),- automation_id: None,- class_name: None,- value: None,- bounds: None,- is_enabled: true,- is_focused: None,- is_keyboard_focusable: None,- children: vec![],+ ..Default::default()},AccessibilityNode {control_type: "Edit".to_string(),name: Some("Search".to_string()),- automation_id: None,- class_name: None,value: Some("typed text".to_string()),- bounds: None,- is_enabled: true,- is_focused: None,- is_keyboard_focusable: None,- children: vec![],+ ..Default::default()},AccessibilityNode {control_type: "Image".to_string(),name: Some("icon.png".to_string()),- automation_id: None,- class_name: None,- value: None,- bounds: None,- is_enabled: true,- is_focused: None,- is_keyboard_focusable: None,- children: vec![],+ ..Default::default()},],+ ..Default::default()};let mut buf = String::new();@@ -710,62 +737,29 @@ mod tests {let tree = AccessibilityNode {control_type: "Pane".to_string(),name: Some("Discord".to_string()),- automation_id: None,- class_name: None,- value: None,- bounds: None,- is_enabled: true,- is_focused: None,- is_keyboard_focusable: None,children: vec![AccessibilityNode {control_type: "Document".to_string(),- name: None,- automation_id: None,- class_name: None,value: Some("https://discordapp.com/channels/123/456".to_string()),- bounds: None,- is_enabled: true,- is_focused: None,- is_keyboard_focusable: None,children: vec![AccessibilityNode {control_type: "Text".to_string(),name: Some("Welcome to the server".to_string()),- automation_id: None,- class_name: None,- value: None,- bounds: None,- is_enabled: true,- is_focused: None,- is_keyboard_focusable: None,- children: vec![],+ ..Default::default()},AccessibilityNode {control_type: "Button".to_string(),name: Some("Send Message".to_string()),- automation_id: None,- class_name: None,- value: None,- bounds: None,- is_enabled: true,- is_focused: None,- is_keyboard_focusable: None,- children: vec![],+ ..Default::default()},AccessibilityNode {control_type: "Custom".to_string(),name: Some("User: john_doe".to_string()),- automation_id: None,- class_name: None,- value: None,- bounds: None,- is_enabled: true,- is_focused: None,- is_keyboard_focusable: None,- children: vec![],+ ..Default::default()},],+ ..Default::default()}],+ ..Default::default()};let mut buf = String::new();@@ -820,6 +814,70 @@ mod tests {);}+ #[test]+ fn test_extension_popup_ignored_via_child_text() {+ use crate::events::AccessibilityNode;++ // Simulates Bitwarden's "New Login" sub-view where the Document node's+ // name is the route title "New Login" (no brand name), but the brand+ // "Bitwarden" appears in a child text element.+ let bitwarden_popup = AccessibilityNode {+ control_type: "Window".to_string(),+ name: Some("".to_string()), // Chrome extension popups have empty window title+ children: vec![AccessibilityNode {+ control_type: "Document".to_string(),+ name: Some("New Login".to_string()), // page title without brand name+ value: Some(+ "chrome-extension://nngceckbapebfimnlniiiahkandclblb/popup.html#/add-login"+ .to_string(),+ ),+ children: vec![+ AccessibilityNode {+ control_type: "Text".to_string(),+ name: Some("Bitwarden".to_string()), // brand name in child+ ..Default::default()+ },+ AccessibilityNode {+ control_type: "Edit".to_string(),+ name: Some("Password".to_string()),+ value: Some("hunter2".to_string()),+ ..Default::default()+ },+ ],+ ..Default::default()+ }],+ ..Default::default()+ };++ let ignored = vec!["bit".to_string()];+ let mut buf = String::new();+ let mut nodes = Vec::new();+ let mut url = None;+ let mut hit = false;++ extract_text_from_tree(+ &bitwarden_popup,+ 0,+ 10,+ &mut buf,+ &mut nodes,+ &mut url,+ &None,+ &ignored,+ &mut hit,+ );++ assert!(+ hit,+ "should detect Bitwarden extension popup via child text even when page title is 'New Login'"+ );+ // Password value must not be in the buffer+ assert!(+ !buf.contains("hunter2"),+ "password content must not be extracted, got: {buf}"+ );+ }+#[test]fn test_excluded_apps() {assert!(EXCLUDED_APPS.iter().any(|ex| "1password".contains(ex)));