fix(security): retry required ACL harden after soft timeout - #782
Conversation
📝 WalkthroughWalkthroughThe change separates required and optional ACL timeout state, improves management-token diagnostics, and hardens Windows service installation, scheduler inspection, stop, uninstall, and proxy cleanup with account, PID, task, and liveness checks. ChangesManagement authentication hardening
Windows service lifecycle hardening
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ServiceStop
participant Scheduler
participant ProxyProcess
participant NativeCodex
ServiceStop->>Scheduler: Stop installed scheduler service
ServiceStop->>ProxyProcess: Validate PID identity and poll liveness
ProxyProcess-->>ServiceStop: Return stopped or still-live state
alt Proxy is stopped
ServiceStop->>NativeCodex: Restore native Codex
else Proxy remains live
ServiceStop-->>ServiceStop: Set failure exit code
end
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e7f61e7c71
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
[shipping-github] Merge-ready |
|
[shipping-github] Security sanity (redacted) — quick pass on Windows admin-token ACL opt-in.
Recommend maintainer security review before merge (auth boundary). |
Verdict: gated
|
|
Reviewed while sweeping open security-boundary work; not landing this one, and the reason is the design rather than the code. A concrete bug first. The larger question. It may not. #766's user-visible complaint is a dashboard that shows nothing plus a permanent false startup warning. The underlying cause is that ACL hardening times out ( If it does land anyway, the negative test that matters: simulate Not closing — this is the maintainer's call under MAINTAINERS.md, and the diagnosis here is solid work regardless of which direction is chosen. @lidge-jun @Ingwannu for the security review. |
|
[shipping-github] Addressed owner feedback — propagate directory ACL soft-continue into aclUnverified; add dir-timeout + file-ok negative tests (503 without opt-in, flag with opt-in). Design preference (timeout fix vs opt-in) still open for maintainer call. |
|
[shipping-github] Addressed owner feedback — pivoted off OPENCODEX_ALLOW_UNVERIFIED_ADMIN_TOKEN_ACL. Timeout memo is now namespaced so loadConfig soft-fails do not poison required management hardens; 503/reason names OPENCODEX_ADMIN_AUTH_TOKEN as the escape. |
|
Ready to merge @lidge-jun @Ingwannu - React Doctor does not seem to be related to this |
GitHub macOS/Linux runners lack USERNAME; fake win32 ACL tests need it.
Bake OPENCODEX_ALLOW_UNVERIFIED_ADMIN_TOKEN_ACL into Task Scheduler and WinSW installs when set at install time, and isolate the opt-in in management-auth tests.
assertSafeDirectory soft-continues were discarded, so /api/settings could under-report. OR directory status into aclUnverified and cover dir-timeout vs file-ok with and without the opt-in.
Drop OPENCODEX_ALLOW_UNVERIFIED_ADMIN_TOKEN_ACL. Namespace the timeout memo so loadConfig soft-fails no longer poison management required:true hardens, and surface OPENCODEX_ADMIN_AUTH_TOKEN as the fail-closed escape on 503.
Keep the PR scoped to the timeout-memo + ADMIN_AUTH_TOKEN escape; restore service/winsw to the prior tip minus only the unverified-ACL bake.
The oldest-first preview case timed out at Bun's 5s default under windows-latest load; siblings already use STORE_BUDGET_MS.
The ACL pivot cleanup commit dropped tip's stdin.isTTY check; keep it.
a37f706 to
0538cc1
Compare
Summary
Fixes #766
Pivots away from
OPENCODEX_ALLOW_UNVERIFIED_ADMIN_TOKEN_ACL. Softrequired:falseACL timeouts duringloadConfigno longer poison laterrequired:truemanagement-token hardens (namespaced timeout memo). When management still cannot initialize,/api/*503 responses include the reason and hint to setOPENCODEX_ADMIN_AUTH_TOKEN.Security
Keeps fail-closed ACL defaults; no unverified-ACL opt-in. Environment admin token remains the explicit escape that skips file-backed hardening.
Test plan
bun test tests/server-management-auth.test.ts tests/windows-secret-acl.test.tsSummary by CodeRabbit