Python path: None title crashes the loop; bad privacy rule action crashes; invalid privacy rules fail open
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript, python
- Domain
- desktop
Research direction
Start in main.py at heartbeat_loop: the transform_window call sits outside the try, and both it and research_filter.transform assume a string title. Reproduce with the three snippets, then read printAppStatus.jxa (only undefined is mapped, not null), compile_privacy_rules (the unhashable action), and the swift branch that refuses to start when rules are configured — that branch is the model for failing closed. Done means non-string titles are coerced, invalid rules are skipped without crashing, and a maintainer has answered whether main() should exit when len(compiled) < len(raw).
Written by the indexing model from the issue text.
Description
Three crash/fail-open cases in the Python path. Each is reproduced on master 76b3f6f with the snippet shown.
1. A None title crashes the loop. transform_window runs outside the try in heartbeat_loop (main.py), so an exception there ends the watcher.
transform_window({"app": "Finder", "title": None}, exclude_titles=[re.compile("x")]) # TypeError
research_filter.transform({"app": "Google Chrome", "title": None}, {"a": "b"}) # AttributeError
printAppStatus.jxa only replaces title === undefined. An AXTitle that is null would pass through as "title": null. I haven't confirmed that on a Mac, so treat the input source as plausible; the crash itself is certain. A likely fix is to also map null in the JXA, and/or coerce a non-string title to "" before the transforms.
2. A non-string privacy action crashes at startup instead of being skipped. The docstring promises invalid rules are "skipped with an error log":
compile_privacy_rules([{"pattern": "x", "action": ["drop"]}]) # TypeError: unhashable type: 'list'
3. An invalid privacy rule fails open. A rule with a bad regex (e.g. a stray () or an unknown action is logged and skipped, and the watcher then sends unfiltered titles on Linux, Windows and jxa/applescript. The swift branch refuses to start when any rule is configured "so titles are not leaked". An invalid exclude_titles regex also exits (try_compile_regex). Should main() exit when len(compiled) < len(raw)? That is a behaviour change, so I'm asking rather than opening a PR.
- Dominant language
- Python
- Stars
- 133
- Forks
- 92
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 4
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ActivityWatch/aw-watcher-window
-
[macos] Accessibility permission prompt reappears every ~10s even after granting accessPossibly taken @StreamOfRon claimed this 57 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
ActivityWatch/aw-watcher-window#163 · 1 comment ·
-
[macos] Swift helper never appears in the Accessibility list on its own; users must manually dig out the helper binaryPossibly taken @StreamOfRon claimed this 57 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
ActivityWatch/aw-watcher-window#123 · 1 comment · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
ActivityWatch/aw-watcher-window#119 · 1 comment ·
All issues in ActivityWatch/aw-watcher-window
Similar issues
-
`gitlab_importer_v2` pipeline failing due to malformed YAML filePossibly taken @Gowri213 claimed this today. Openbug Pipeline: Failure Priority: high
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
aboutcode-org/vulnerablecode#2523 · 1 comment ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
intuitem/ciso-assistant-community#5380 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
confluentinc/cp-ansible#2767 ·
Maintainers usually reply within 3 days
-
bug docs
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 2 days