[codex] Complete passwordless sudo expiry across suspend - #9457
[codex] Complete passwordless sudo expiry across suspend#9457AFOliveira wants to merge 2 commits into
Conversation
|
Regardless of the security aspects, there is way too much code duplication across this entire series! This should be reworked to extract the common methods to make it much easier to review. |
I agree. The rate at which I'm catching these vulns is higher than my bandwidth, I need a better workflow to avoid becoming a slop-machine. I 'm reworking this PR |
df81688 to
87625c2
Compare
|
Addressing Axel’s review before continuing the series:
Local validation on 2f816a8 against exact base 945af75:
I will not mark any dependent draft ready until its copied helpers are removed and its final branch passes the same local gate. |
Depends on
This is an incremental follow-up to #9387. The branch is based on
security/nopasswd-expiry-fail-closed, preserving Erik Melton's commit andAdolanium's co-authorship unchanged. Merge #9387 first, then rebase this branch
onto
quattrobefore merging.Problem
#9387 correctly makes timer-creation failure and reboot cleanup fail closed,
but its monotonic
--on-activetimer pauses during suspend. A 15-minute grantcan therefore remain usable after a much longer sleep.
The surrounding flow also needs one authoritative identity, state record, and
transaction boundary so timer races or a reusable sudo timestamp cannot
publish a grant without its promised expiry.
Finding: OM-SEC-01
Incremental remediation
--on-calendar=@EPOCH, so suspend time counts.EXPIRESduring status checks and synchronously revokean overdue grant before reporting it active.
validated numeric UID under one root lock.
every partial or replacement failure revokes the grant.
exit path.
package removal.
Shared code and series structure
This PR introduces only the 87-line subset of
omarchy-security-functionsused here. It centralizes privileged Bash startup checks, root-directory
validation, and fail-closed sudo cleanup. The remaining security PRs will be
rebased after this foundation lands and will source these methods instead of
carrying copies. They do not need to merge as one oversized PR.
The settings-package removal hook is a coordinated companion change and must
ship with this PR. omacom/omarchy-pkgs#257 is an 8-line follow-up to the
package-ownership work in omacom/omarchy-pkgs#239.
Validation
test/shell.d/nopasswd-sudo-expiry-test.sh./test/clibash -non every changed shell filegit diff --check./test/allreaches all 222 shell files; the only failure is the unchangedtest/shell.d/launch-about-test.shUI fixture (a roomy window animates). Thesame file fails identically on the untouched
quattrobaseline, and neitherit nor
bin/omarchy-launch-aboutdiffers from #9387.Regression coverage includes suspend-safe calendar arguments, overdue state,
timer races, failed replacement timers, malformed state, conservative boot
cleanup, package removal, concurrent calls, trusted caller identity, and sudo
credential cleanup.