Sanitize hostname metadata from Research Edition exports - #1408
Merged
ErikBjare merged 1 commit intoAug 26, 2026
Merged
Conversation
Watchers store buckets as {client}_{hostname}. /api/0/export copied that
machine name into the map key, embedded id, and hostname field — six leaks
per window+AFK pair on a named laptop. Patch the Rust export path only when
AW_RESEARCH_EDITION=true so standard builds stay unchanged. Fail closed on
sanitized-ID collisions and on unfiltered historical window events.
Contributor
Greptile SummaryThe PR adds a Research Edition-only build patch that sanitizes bucket hostname metadata at both Rust export endpoints and rejects ambiguous or apparently unfiltered exports.
Confidence Score: 5/5The PR appears safe to merge, with no concrete changed-code failure established on the supported Research Edition export path. The release workflow patches the Rust source before compilation, the patcher fails when expected insertion points are unavailable, and the sanitizer keeps the exported map key, embedded ID, and hostname aligned while rejecting collisions. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Research Edition release job] --> B[Patch Rust export endpoints]
B --> C[Build Rust server]
C --> D[Client requests export]
D --> E[Load exported buckets]
E --> F{Unfiltered event data?}
F -- Yes --> G[HTTP 409]
F -- No --> H[Rewrite key, ID, and hostname]
H --> I{Sanitized identity collision?}
I -- Yes --> G
I -- No --> J[Return sanitized export]
Reviews (1): Last reviewed commit: "feat(research): sanitize hostname metada..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Research Edition
/api/0/exportcurrently copies the machine hostname into every bucket's map key, embeddedid, andhostnamefield. On a named laptop that is a participant identifier. The live Research filter already rewrites eventapp/title/url; it never touched bucket identity.This adds a Research-build-only patch at the Rust export boundary (same injection style as
patch_research_edition_config.py). Standard builds do not run the patcher.id, andhostnametogether toresearch-participant.currentwindowevents still carry raw titles/URLs/app names, so an existing ActivityWatch database cannot look study-safe.Measured against the published
v0.14.0b4-researchwindow + AFK watchers under a UTS hostnameParticipant-Alice-MacBook: unpatched export had 6 hostname occurrences; the patched server had 0. Unpatched current-source server still leaks (negative control).Tauri remains out of scope for the September participant path.
Test plan
pytest scripts/tests/test_patch_research_edition_export.pycargo test -p aw-server --lib sanitizeafter applying the patchtest_import_exportstill passes on the patched tree