Skip to content

Move screenrecording state files out of predictable /tmp paths - #9033

Closed
gauravbhatia4601 wants to merge 1 commit into
omacom:quattrofrom
gauravbhatia4601:fix/secure-screenrecording-state
Closed

gauravbhatia4601 wants to merge 1 commit into
omacom:quattrofrom
gauravbhatia4601:fix/secure-screenrecording-state

Conversation

@gauravbhatia4601

@gauravbhatia4601 gauravbhatia4601 commented Aug 29, 2026 •

Copy link
Copy Markdown

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:

  • RECORDING_FILE -> ${XDG_RUNTIME_DIR:-/tmp}/omarchy-screenrecord-filename
  • LOG_FILE -> ${XDG_RUNTIME_DIR:-/tmp}/omarchy-screenrecord.log

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

  • bash -n clean on the modified script
  • test/shell.d/screenrecording-test.sh passes (18/18 assertions)
  • test/shell.d/logging-test.sh passes
  • ./test/cli passes
  • Full ./test/shell run: 2571 assertions pass; the 19 failing files on this headless container are pre-existing environmental failures (missing lua, fonts, compositor) and fail identically on an unpatched checkout of the same commit.

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
@gauravbhatia4601

Copy link
Copy Markdown
Author

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.

@gauravbhatia4601
gauravbhatia4601 marked this pull request as draft August 30, 2026 18:23
@gauravbhatia4601
gauravbhatia4601 marked this pull request as ready for review August 30, 2026 18:24
@omarchybot omarchybot added bug Something isn't working and removed bug Something isn't working labels Sep 27, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

quattro already fixes this. #8374 merged on 2026-09-15 as b44fb74 and closed #8372, the issue this pull request fixes.

Both make the same change for the same reason: they move RECORDING_FILE and the debug LOG_FILE in bin/omarchy-capture-screenrecording from fixed /tmp names into the per-user runtime directory, and update the log path in capture.md and contributing.md. On top of that, #8374 falls back to ${XDG_STATE_HOME:-$HOME/.local/state}/omarchy when XDG_RUNTIME_DIR is unset, instead of /tmp, which this branch keeps as the fallback. It also resolves the region file the same way in omarchy-capture-webcam-resize. This branch adds nothing quattro lacks, and it no longer merges cleanly because quattro rewrote the same lines. The recommendation is to close it as a duplicate of #8374.

Checked by Claude Opus 5.5, by reading both diffs against quattro. Nothing was run, because the change is already on quattro. No second opinion ran: the reviewer (Codex Medium) has used up today's review allowance, and closing a duplicate requires one. So this is left open for the maintainer to close rather than closed here.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thank you for this, @gauravbhatia4601. Closing because #8374 already fixes this on quattro.

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.

@omarchybot omarchybot closed this Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security] Screen recording keeps the in-flight recording path at a fixed /tmp name, and that path drives ffmpeg, mv and rm

2 participants