feat(capture): support per-app/per-URL capture exclusions - #30
feat(capture): support per-app/per-URL capture exclusions#30rogerdigital wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces privacy exclusion rules to skip window captures based on application names, bundle IDs, or window title patterns. It also improves datetime handling by ensuring that timestamps retrieved from the database or used in timeline aggregation are consistently timezone-aware. Feedback includes a suggestion to prevent empty strings in title patterns from matching all windows and a recommendation to omit window titles from logs when a capture is excluded to maintain privacy.
| return True | ||
| if cfg.excluded_window_title_patterns and meta.title: | ||
| title_lower = meta.title.lower() | ||
| if any(p.lower() in title_lower for p in cfg.excluded_window_title_patterns): |
There was a problem hiding this comment.
If excluded_window_title_patterns contains an empty string, the any(p.lower() in title_lower ...) check will return True for any non-empty window title, effectively excluding all windows from capture. It is safer to ensure the pattern p is non-empty before performing the substring match.
| if any(p.lower() in title_lower for p in cfg.excluded_window_title_patterns): | |
| if any(p and p.lower() in title_lower for p in cfg.excluded_window_title_patterns): |
There was a problem hiding this comment.
Fixed in b119274 — empty patterns are now skipped via p and p.lower() in title_lower.
| logger.info( | ||
| "capture skipped (excluded): app=%r title=%r bundle=%r", | ||
| meta.app_name, meta.title[:60], meta.bundle_id, | ||
| ) |
There was a problem hiding this comment.
Logging the window title of an excluded window may inadvertently leak sensitive information that the user specifically intended to keep private by using the exclusion feature. Since these rules are often used for privacy-sensitive contexts (e.g., Incognito windows, password managers), it is safer to omit the title from the logs or only log the app name and bundle ID.
| logger.info( | |
| "capture skipped (excluded): app=%r title=%r bundle=%r", | |
| meta.app_name, meta.title[:60], meta.bundle_id, | |
| ) | |
| logger.info( | |
| "capture skipped (excluded): app=%r bundle=%r", | |
| meta.app_name, meta.bundle_id, | |
| ) |
There was a problem hiding this comment.
Fixed in b119274 — removed title from the exclusion log, only app_name and bundle_id are logged.
Add three optional [capture] config fields — excluded_window_title_patterns, excluded_app_names, excluded_bundle_ids — that cause matching windows to be skipped entirely before any AX query, screenshot, or disk write. Title patterns use case-insensitive substring match; app names and bundle IDs use case-insensitive exact match. All default to empty lists so behaviour is unchanged unless opted in. Closes Einsia#27
…on log
- Skip empty strings in excluded_window_title_patterns so they don't
match every window ("" in "anything" is True)
- Don't log the window title on exclusion — the user excluded it for
privacy, logging it defeats the purpose
b119274 to
6334eb6
Compare
|
Please add documentation for the newly introduced configuration items in |
Add a 'Privacy exclusions' subsection under [capture] in docs/config.md covering excluded_window_title_patterns, excluded_app_names, and excluded_bundle_ids — match semantics, defaults, and logging behavior.
|
Added in c297321 — documented all three fields under a new "Privacy exclusions" subsection in |
Summary
[capture]config fields:excluded_window_title_patterns,excluded_app_names,excluded_bundle_idsUsage
Tests
test_excluded_app_name_skips_capture— exact app name matchtest_excluded_bundle_id_skips_capture— exact bundle ID matchtest_excluded_title_pattern_skips_capture— substring title matchtest_non_excluded_window_proceeds— non-matching windows pass throughtest_exclusion_is_case_insensitive— case-insensitive matchingtest_exclusion_with_empty_title_does_not_match_pattern— empty title doesn't trigger pattern matchAll 111 tests pass, ruff clean.
Closes #27