openai / openai/codex-security
Selected profile cannot relax a root `approval_policy = "never"`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10.8k
- Forks
- 801
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 257
Description
Summary
scanApprovalPolicy() does not use the same selected-profile precedence as the other effective Codex settings.
Model, reasoning effort, and provider resolution all prefer an explicitly configured value in the selected profile over the root value. Approval policy instead computes:
return config["approval_policy"] === "never" ||
selectedScanProfile(config)?.["approval_policy"] === "never"
? "never"
: "on-request";
If the root config says approval_policy = "never" and the selected profile explicitly says approval_policy = "on-request", this returns "never" rather than the selected profile's value.
Impact
This is not display-only. The resolved value is passed to codex.startThread({ approvalPolicy }), written into the scan recipe/preflight configuration, and projected into scanRuntimeCodexConfig().
A selected profile therefore cannot restore on-request approvals when the root config is more restrictive, even though profile-specific model/provider settings already override their root counterparts.
Expected behavior
If the selected profile has its own approval_policy, resolve that value first. Otherwise fall back to the root setting. Codex Security only needs to distinguish the supported never and on-request outcomes.
Suggested fix
Mirror scanModelProvider()/scanModelConfiguration() precedence for approval_policy, and add regression cases for both directions:
- root
never, selected profileon-request->on-request; - root
on-request, selected profilenever->never.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate scanApprovalPolicy(), then compare its precedence with scanModelProvider() and scanModelConfiguration(). Add regression coverage for both root/selected-profile approval_policy combinations: root never with selected on-request, and root on-request with selected never. Confirm the resolved value remains consistent through codex.startThread({ approvalPolicy }), scan recipe/preflight configuration, and scanRuntimeCodexConfig().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, security
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100