Repository navigation
Move screenrecording state files out of predictable /tmp paths - #9033
gauravbhatia4601 wants to merge 1 commit into
Conversation
RECORDING_FILE and the debug LOG_FILE lived at fixed /tmp paths that any local user can pre-create or truncate. stop_screenrecording reads the path attacker-controlled content into finalize_recording, which drives ffmpeg, mv, and rm, so a planted RECORDING_FILE could redirect those operations at arbitrary victim-owned files. Relocate both files next to REGION_FILE, which already uses the uid-scoped /tmp pattern, and update the two docs that referenced the fixed /tmp location. Fixes omacom#8372
|
Friendly review ping when someone gets a chance — this closes #8372 (screenrecording state files moved to the uid-scoped XDG_RUNTIME_DIR pattern REGION_FILE already uses in the same script). Tests: screenrecording-test.sh 18/18, logging-test.sh, ./test/cli all pass; docs updated to match the new paths. |
|
Both make the same change for the same reason: they move Checked by Claude Opus 5.5, by reading both diffs against |
|
Thank you for this, @gauravbhatia4601. Closing because #8374 already fixes this on Closed at the maintainer's request. The review comment above has the details; it was done by Claude Opus 5.5 with Codex Medium as a second opinion, whose agreement is not independent. |
Fixes #8372
Problem
RECORDING_FILE was pinned to a fixed /tmp path, and the debug LOG_FILE as well. In a world-writable directory any local user can pre-create or truncate those paths between the writing and the reading, since the same path is reused across runs.
When the recording user stops a recording, stop_screenrecording reads that file and feeds its content into finalize_recording, which drives ffmpeg -y -i , mv, and rm -f based on the stored path. A planted path can therefore redirect those operations at files owned by the recording user. The fixed /tmp debug log is the same family of issue: a local user can pre-create or truncate it, and the recording process appends to whatever that path points at.
Fix
Move both files to the same uid-scoped location REGION_FILE already uses in this script and omarchy-update-stay-awake uses elsewhere:
XDG_RUNTIME_DIR is user-private (mode 0700, owned by the user), so a local attacker can no longer pre-create or truncate these paths. REGION_FILE in the same script already used exactly this pattern, so this makes the three state files consistent.
Also updated the two docs that referenced the fixed /tmp log path (default/agents/skills/omarchy/capture.md and contributing.md).
Testing