Repository navigation
Conversation
Bash can reap the substitution before wait runs and then report it is not a child of this shell, so privileged entrypoints failed at random. An end record written only after env succeeds proves the scan read everything.
[Medium impact] The PR appears safe to merge. Summary
Reviews (1) · Last reviewed commit: "Stop waiting on the environment scan's p..." · Reviewed by Greptile |
|
Reviewed by GPT-6 in Codex (effort not exposed): I read the environment scan, its privileged callers, and the current I classified this as a bug fix, but the second classifier, deepseek-v4p1-flash (effort not reported), returned no classification. Classification therefore remains unsettled. No substantive second review or worker tests ran; the unused worker was destroyed. The existing CI checks passed at |
|
The bug classification is now agreed. At Current Checked by GPT-6 in Codex (effort not exposed), with source review by Opus 5.5 High and muse-wonder via pi, thinking high. Both reviewers agreed that #19096 covers the fix; independence is not guaranteed. A worker probe ruled out the panel’s proposed raw-environment sentinel spoof: Bash discards the no- |
What changes
omarchy_security_sanitize_bash_environmentreadsenv -0through a process substitution and then runswaiton the substitution's PID to make sure the listing completed. Bash sometimes reaps that child first and then answers thewaitwith:waitthen returns 127, the sanitizer returns 1, and the privileged entrypoint that called it (omarchy-update-stay-awake,omarchy-sudo-passwordless) exits underset -ebefore doing anything. For a user that means an update's sleep inhibitor sometimes fails to start or stop. In CI it shows up as an unrelated test file failing at random.This drops the
wait. The producer now writes an end record afterenv -0succeeds, and the reader requires that record to be the last one it saw. A failed or truncated listing still fails closed, and nothing depends on bash's child bookkeeping anymore.Where it was seen
Two of the last 40 failed
Testsruns fail with exactly this message, each in a different file:update-lock-test.shomarchy-update-stay-awake stop, right after "first upgrade cleans old inhibitor state"launcher-activation-token)update-stay-awake-security-test.shQA report
All runs below were on GitHub runners in my fork. Each one ran quattro (
9b525a935) and this branch side by side.1. Race stress. A minimal
#!/bin/bash -pentrypoint, started as a fresh process each time, does whatomarchy-update-stay-awakedoes before its first command. It checks the Bash startup, sources the helper, and sanitizes the environment.yeshogsyeshogsI could not reproduce the "not a child" message outside the CI VM. The single quattro failure on Ubuntu printed something else, and my harness did not keep its output. So this table shows the change adds no failures, not that it removes the CI one. The fix stands on the code path: the only
waitthat could print that message is gone.2. The check still fails closed.
BASH_ENVand an exportedBASH_FUNC_x%%in the environmentenvfails before listing anythingenvlists everything, then failsThe last two rows swap the producer for a failing command in a patched copy of the helper.
3. Every test file that covers the helper's three callers, three runs each. Arch container, run as a non-root user:
security-bash-startupsecurity-entrypoint-symlinksecurity-source-rootnopasswd-sudo-expirypasswordless-grant-lifecyclepasswordless-sudo-indicatorupdate-boot-verifyupdate-hook-securityupdate-sequencebin-styleupdate-stay-awake-securityupdate-lockThe last two rows needed
/run/user/$UIDcreated, which a container doesn't provide.update-lockfails on both trees at the same step in the container. It passes that step in this repo's CI VM, so the failure comes from the container.4. Static checks.
bash -nandgit diff --checkare clean.Not added: a regression test. The race doesn't reproduce on demand, so no test can fail on quattro. Testing the fail-closed path means replacing
/usr/bin/env, which the helper calls by absolute path. The fullTestsrun on this PR covers the rest.Screenshots
No visible change: this fixes a startup check in privileged shell helpers.