Repository navigation
fix: let Codex read the target on Windows (SECFOO-38) - #24
Merged
Merged
Conversation
With no Windows sandbox configured, `codex exec --sandbox read-only`
rejects every command on Windows, reads included ("blocked by policy"),
so Codex never saw the target. Pass `-c windows.sandbox="unelevated"` on
Windows: the restricted-token sandbox needs no admin setup and, verified
on codex-cli 0.159.2, allows reads while denying writes both inside and
outside the workdir.
Real `secfoo run -s secret-scanning -s sast -a codex` on Windows 11 now
succeeds with no rejected commands; SAST finds the planted SQL injection
(CWE-89) and command injection (CWE-78).
The failure message no longer suggests the elevated admin setup, which
turned out to be unnecessary.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
Author
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.
Summary
Fixes SECFOO-38, the open Codex item from #23: on Windows, Codex couldn't read the target at all.
Cause: with no Windows sandbox configured,
codex exec --sandbox read-onlyrejects every shell command on Windows, reads included (exec_command failed ... rejected: blocked by policy). #23 made secfoo report those runs asfailedinstead of a falsesuccess, but they still couldn't succeed.Fix: on Windows only, pass
-c windows.sandbox="unelevated". Codex's restricted-token sandbox needs no admin setup, and it still enforces read-only. The elevated setup that #23's failure message suggested turned out to be unnecessary, so that hint is removed.Verification (Windows 11, codex-cli 0.159.2)
Read-only enforcement, tested directly with
codex exec --sandbox read-only -c windows.sandbox="unelevated":app.pyin the workdirAccess to the path ... is denied)git statusin the target afterwardsReal
secfoo run -a codexon the SECFOO-10 fixture repo:sastfailed: every command rejected, target never readsuccessin about 50s: SQL injection (CWE-89,app.py:19) and command injection (CWE-78,app.py:27), parsed byextract_findings_register_rowssecret-scanningfailed, same causesuccess: readsapp.pyand treats the AWS documentation example keys as placeholders, not findingsI re-ran the SAST E2E after rebasing onto current
main, which includes #19 and #21 (SECFOO-37 token usage), and it still passes.Notes for review
windows.sandboxkey.windows.sandbox = "elevated"in~/.codex/config.tomlis replaced withunelevatedfor secfoo runs. Both are sandboxed and read-only, so this isn't a weakening, but it's worth knowing._IS_WINDOWSis a module-level flag so tests can switch it without patchingos.name, which breaks pytest (see the existing note inbase.py).Test plan
read-only; other platforms don't get itpytest: 730 passed, 5 failed. The 5 (test_cloudpermissions and 4 architecture dashboard tests) fail the same way onmainon Windows.sastandsecret-scanningruns on Windows