Conversation
`scanRuntimeCodexConfig` pins `allow_login_shell: false` for the scan runtime and deletes the sibling execution and permission keys from every configured profile so a selected profile cannot restore them. It never deleted `allow_login_shell`, so `profiles.<name>.allow_login_shell = true` survived hardening and, by the profile precedence this SDK applies in `resolveCodexProfile`, won over the pinned top-level value. Delete it alongside the other five keys.
|
Note You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
scanRuntimeCodexConfigbuilds the Codex config a scan runs under. It pins a set of execution keys and, because a selected profile takes precedence over the top-level table, it also deletes those same keys from every configured profile so a profile cannot put them back:allow_login_shellis pinned tofalsein the returned config next toapproval_policyanddefault_permissions, but it is the one pinned key with no matching per-profile delete. A configuredprofiles.<name>.allow_login_shell = truetherefore survives hardening, and the profile layer is what the scan runtime ends up applying —resolveCodexProfileinconfig.tsdeep-merges the selected profile over the top-level config, andscanApprovalPolicyalready readsselectedScanProfile(config)?.["approval_policy"]for exactly that reason.So a scan started with a profile that sets
allow_login_shell = trueruns with the login shell the scan runtime is supposed to disable, while the emitted top-level config still readsallow_login_shell = false.The override reaches this function through ordinary public CLI surface —
codex-security scan . --codex 'profile="p"' --codex 'profiles.p.allow_login_shell=true'is accepted;validateOverridesonly ownsplugins,marketplacesandfeatures.plugins.Changes
sdk/typescript/src/api.ts: adddelete profile["allow_login_shell"];to the per-profile strip loop inscanRuntimeCodexConfig, alongside the five keys already removed there.sdk/typescript/tests-ts/api-preflight-config.test.ts: regression test covering the selected profile and an unselected one.Testing
Observed through the exported SDK function, before and after the change, with the same input.
Before, on unmodified
main:sandbox_modeandapproval_policywere stripped from the profile;allow_login_shell: truewas not, and it contradicts the pinned top-levelfalse.New test against unmodified
main:After the change, same input:
Checks run:
bun test --timeout 30000 ./tests-ts/api-preflight-config.test.ts— 17 pass, 0 failbun test --timeout 30000 ./tests-ts/config.test.ts— 22 pass, 1 skip, 3 fail. The 3 failures are pre-existing on this Windows machine and unrelated to this change: all three abort withWindows credential-home ancestor allows another identity to replace the directory, and they fail identically with the change stashed (22 pass / 3 fail on unmodifiedmain).tsc --noEmit(lint) — cleantsc -p tsconfig.ci.json(build:ci) — cleanprettier --checkon both changed files — All matched files use Prettier code style!Risk and rollout
No public CLI surface change: no new command, flag, environment variable, or default. The pinned
allow_login_shell: falsein the returned config is unchanged; the only difference is that a profile can no longer contradict it, which matches how the other five hardened keys already behave.Compatibility: a user who set
profiles.<name>.allow_login_shell = trueand relied on it taking effect during a scan will see that setting ignored during scans. It is already ignored for policy generation, which resolves the profile throughresolveCodexProfilebefore hardening, so this brings scans in line with the existing behaviour of the neighbouring path. Profiles are otherwise untouched, and configs with noprofilestable are unaffected.Public disclosure review