Repository navigation
Conversation
Fixed, predictable paths under /tmp let another local account pre-create them: as symlinks (so the victim's write clobbers a victim file through the redirect) or as readable files (so log content is disclosed to them). fs.protected_symlinks and fs.protected_regular block both on default configurations, but those are kernel policy, not a property of these scripts; mktemp is safe regardless of the host's sysctls. - omarchy-upload-log: payload and system-info files via mktemp, removed on exit - omarchy-debug: debug log via mktemp, removed on exit - omarchy-install-gaming-battlenet: detached installer log via mktemp - omarchy-update: script(1) transcript via mktemp, path handed to the logged instance through OMARCHY_UPDATE_LOG, removed on exit - omarchy-update-analyze-logs: read the transcript from OMARCHY_UPDATE_LOG instead of guessing a fixed location Adds test/shell.d/tmp-predictable-path-test.sh: scans bin/, install/, and migrations/ for fixed /tmp paths so a new one cannot be reintroduced, with an allowlist for the validated state base and comment references.
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.
Five scripts write temporary files to fixed, predictable paths under
/tmp: the upload payload inomarchy-upload-log(/tmp/upload-log.txt,/tmp/system-info.txt), the debug log inomarchy-debug(/tmp/omarchy-debug.log), the Battle.net installer log inomarchy-install-gaming-battlenet(/tmp/omarchy-battlenet-installer.log), and the update transcript inomarchy-update(/tmp/omarchy-update.log, read back byomarchy-update-analyze-logs). Since/tmpis world-writable and the sticky bit only stops deletion, not creation, another local account can pre-create any of these names as a symlink to a file in the victim's home; the next run of the script then clobbers that file through the redirect, as the victim. I wrote these asmktempin each case, with atrapto remove the files on exit where the script owns the whole lifecycle, andomarchy-updatenow hands the transcript path to its logged instance throughOMARCHY_UPDATE_LOGinstead of both sides agreeing on a fixed name.fs.protected_symlinksandfs.protected_regularblock the symlink and swap variants on default kernel configurations, but those are kernel policy rather than a property of the scripts;mktempis safe regardless of the host's sysctls. This is the same class the stay-awake state path fix moved into a validated private directory, and #14078 covers the debug and upload-log sites with the same approach — this PR adds the update transcript, the Battle.net installer log, and the analyze step.I verified this on the current
quattroin a Try Omarchy VM. All five scripts passbash -n, andomarchy-upload-log this-bootandomarchy-debug --print --no-sudorun to completion with the temp files gone on exit. The newtest/shell.d/tmp-predictable-path-test.shscansbin/,install/, andmigrations/for fixed/tmppaths as a net rather than a proof, followingunowned-system-paths-test.sh: every literal fixed path is flagged, with an allowlist for the validated stay-awake state base and paths named only in comments. It passes on this branch, and putting any of the five old paths back — e.g.TEMP_LOG=/tmp/upload-log.txt— fails it with that file and line.Happy to adjust. -MB