Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
Privately stages sensitive diagnostic data and removes temporary files after use.
Changes:
- Replaces fixed
/tmppaths withmktempfiles and cleanup traps. - Updates diagnostics documentation.
- Adds shell tests for staging and cleanup behavior.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
bin/omarchy-debug |
Secures temporary diagnostic logs. |
bin/omarchy-upload-log |
Secures and cleans upload staging files. |
test/shell.d/diagnostics-staging-test.sh |
Tests private staging behavior. |
default/agents/skills/omarchy/contributing.md |
Removes obsolete fixed-path guidance. |
default/agents/skills/diagnose-crash/reporting.md |
Updates diagnostic reporting instructions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
The same treatment now covers the other two fixed /tmp paths in bin/:
Tests: |
|
One more round on the comments and the Battle.net log. A correction to my earlier comment: I said another local user could "pre-create it as a link". That is wrong on a default systemd system. The Battle.net log drops |
669a3d1 to
7ca81eb
Compare
|
hey, this is already covered in #12109 (private diagnostics staging out of shared /tmp). mind closing this as a duplicate? |
omarchy-debug wrote sudo dmesg output and the boot journal to /tmp/omarchy-debug.log, and omarchy-upload-log built its bundle at /tmp/upload-log.txt and /tmp/system-info.txt. All three were created under the default umask, so any local user could read them, and none was removed afterwards. Stage all three with mktemp and clear them on exit.
…p paths omarchy update wrote its transcript to /tmp/omarchy-update.log and omarchy-install-gaming-battlenet wrote the installer log to /tmp/omarchy-battlenet-installer.log. At a fixed name in /tmp another local account could read the file, and with fs.protected_regular a second user running the same command got "Permission denied" on the file the first user left behind. The transcript is read back by omarchy-update-analyze-logs, so it keeps a stable name but moves to ~/.local/state/omarchy/update.log. The Battle.net log is written by a detached process after the script exits, so a trap cannot clean it up; it now lives at a fixed name in ~/.cache/omarchy, which is already private to the user, and each run overwrites the last. docs/update-process.md names the new transcript path.
omarchy-debug has no set -e, so a failed log write still exited 0 and --print showed an empty log. The update transcript and the Battle.net installer log had moved off /tmp, but script and the detached installer create those files at the caller's umask, and mkdir -p does not tighten a directory that already exists. Exit nonzero when the debug log cannot be written. Create the update state directory mode 0700, refuse a symlink there, drop a symlink at the log path, and make the transcript mode 0600 before script opens it. chmod ~/.cache/omarchy to 0700 before the Battle.net installer writes. Remove leftover world-readable diagnostics files this user still owns in /tmp.
7ca81eb to
1fbc6b6
Compare
|
This pull request was opened on August 24, three weeks before #12109. #12109 leaves /tmp/omarchy-battlenet-installer.log in place. The detached installer writes that log after the script exits, so it is still world-readable on quattro. The debug log, the upload bundle, and the update transcript overlap, and the fixes differ. This branch removes the debug and upload files on exit. The update transcript stays at ~/.local/state/omarchy/update.log so it is still there after logout. The branch now checks a failed debug write, creates that state directory mode 0700, makes the transcript mode 0600, sets ~/.cache/omarchy to mode 0700 before the Battle.net log is written, and migrates leftovers this user still owns in /tmp. |
Resolves the conflicts with the update security foundation on quattro: the transcript path from prepare_update_log is passed to script alongside the preserved OMARCHY_UPDATE_USER_PATH, and the paths table keeps quattro's stay-awake row and restart description. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On quattro, omarchy-update resets PATH to $OMARCHY_PATH/bin and checks its source root before the logging exec, so the stub script on the caller's PATH was never reached: the test ran the real script(1) and the real update, and stopped at its confirmation prompt. The transcript cases now run a boundary copy of omarchy-update with the stand-in in its bin/, as update-user-path-test.sh does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
|
Reviewed and run on a disposable Omarchy worker. The fix holds on Reproduction. I ran my own check on the worker against Pushed:
Tests. I ran Second opinion. Codex Medium ran two rounds. The first found the test bypass above, which I confirmed on the worker before fixing. It also flagged two things I left alone. One was the migration skipping Related. This PR now says it closes #8367, which describes exactly this bug. It also closes #11204, because This is waiting on the maintainer. |
|
Closing after maintainer review. We are not accepting this as a security vulnerability that warrants these changes for Omarchy's intended single-user desktop setup. The cross-account disclosure scenario requires an additional untrusted local account, or a separately compromised service account, plus a run of the relevant command. The report has not demonstrated a sensitive credential disclosure or a consequential exploit in the default setup. Root can already read this information, and malicious programs running as the desktop user can still read it after a move to a private file or directory. Hostname, hardware details, and package inventory alone do not establish a security vulnerability. The default systemd protections ( The default Private staging and explicit cleanup can be reasonable housekeeping, but we do not consider the demonstrated behavior a security priority for the default Omarchy threat model. We are declining this family of security-motivated changes on that basis. References: systemd default protections, kernel documentation, default tmpfs mount. The author has already corrected the earlier symlink exploit claim. The remaining diagnostics disclosure and cross-user filename collisions require the additional local-account scenario above. The missing-transcript behavior tracked in #11204 is a separate functional issue and is not being closed by this decision. Omabot on behalf of DHH |
omarchy-debug gathers the machine's diagnostics into a file at a fixed name:
`�ash
LOG_FILE="/tmp/omarchy-debug.log"
if [[ = "true" ]]; then
DMESG_OUTPUT="(skipped - --no-sudo flag used)"
else
DMESG_OUTPUT=""
fi
cat > "" <<EOF
`
The redirect creates that file under the caller's umask, which is 022, so it lands mode 0644 in a directory every local user can reach. The interesting part is what goes in it. sudo dmesg is elevated on purpose, because the kernel ring buffer is not readable by an ordinary user, and the script then writes it somewhere an ordinary user can read. The boot journal at -p 4..1 and the full package inventory go in alongside it. Nothing removes the file, so the last run's log sits there until reboot.
omarchy-upload-log does the same thing with /tmp/upload-log.txt and /tmp/system-info.txt. Those hold the assembled bundle, including the install logs and the journal, and are likewise never removed.
A planted symlink is not the way this goes wrong. s.protected_symlinks and s.protected_regular are on by default, so another user planting a symlink or a regular file makes the redirect fail rather than succeed somewhere unintended. For the upload bundle that failure is still a problem: curl uploads the file already at the name and prints the URL as this user's log. What remains either way is disclosure: a predictable name, a readable mode, and content the machine went out of its way to elevate for. Omarchy is a single-user desktop, so this only matters on machines with more than one local account.
All three now go through mktemp, which creates at 0600 under a name nobody can guess, with a trap clearing them on the way out. Every use of the files is a read by path, so nothing else in either script had to change. omarchy-debug has no set -e, so a failed write is checked on its own and the command exits nonzero. Without that check --print would exit 0 with an empty log.
Two more fixed /tmp paths in �in/ get the same treatment:
Moving these two off /tmp has a side benefit. With s.protected_regular on, a second local user running the same command got "Permission denied" on the file the first user left behind. Per-user paths remove that collision.
Migration 1790092800.sh removes /tmp/omarchy-debug.log, /tmp/upload-log.txt, and /tmp/system-info.txt when they are regular files owned by the current user. Symlinks, directories, and files owned by someone else are left alone.
Two agent skill docs mentioned /tmp/omarchy-debug.log as a side effect of omarchy debug --no-sudo --print. The primary route there is --print, which puts the same content on stdout, and the interactive menu still offers "Save in current directory" for anyone who wants a file. Both mentions are updated rather than left pointing at a path that no longer exists.
Tests: est/shell.d/diagnostics-staging-test.sh stubs the collectors and points TMPDIR at a directory the test owns. It checks --print still prints what was gathered, that the run removes the file it staged, that nothing is left behind, and that neither script names a /tmp literal. The cleanup case is checked through an
m stub that records what it was asked to remove, because an empty staging directory on its own would also pass for a script that never staged there, which is exactly what the old fixed path did. Further cases cover a failed debug write, the transcript landing under XDG_STATE_HOME, the fallback to ~/.local/state when it is unset, directory mode 0700 and file mode 0600, an existing transcript kept and tightened rather than emptied, a symlink state directory refused, a symlink transcript dropped without writing through it, a directory at the transcript path refused, omarchy-update-analyze-logs reading from the new path, staying quiet on a good run, ignoring a symlink, and staying quiet when the file is missing, and the Battle.net log pointing at the fixed name in a cache directory that was mode 0755 and is now 0700, including a symlink cache directory that is refused. est/shell.d/diagnostics-tmp-migration-test.sh covers owned leftovers removed, a rerun, symlinks left alone, and a directory at the legacy name left alone. The other-owner case skips where chown is unavailable. Both files pass. I ran them directly; the rest of ./test/shell and ./test/cli depend on tools my environment does not have (jq, lua, magick), so I did not run them.
Fixes #8367
Fixes #11204