Skip to content

AST-197171 - Enable severity threshold for Codex with Critical & High default - #1640

Open
cx-kedar-bhujade wants to merge 1 commit into
feature/secret-for-cli-agentsfrom
feature/AST-197171-codex-severity-threshold
Open

cx-kedar-bhujade wants to merge 1 commit into
feature/secret-for-cli-agentsfrom
feature/AST-197171-codex-severity-threshold

Conversation

@cx-kedar-bhujade

@cx-kedar-bhujade cx-kedar-bhujade commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

By submitting this pull request, you agree to the terms within the Checkmarx Code of Conduct. Please review the contributing guidelines for guidance on creating high-quality pull requests.

Description

Codex now honours cx_severity_threshold from ~/.checkmarx/cx-onboarding.properties. When the setting is not set, only Critical and High findings block a Codex write.

This PR is stacked on #1626 and targets its branch, so the diff shows only the Codex change.

The flow, in hooks.go:

  1. ASCA, KICS, SCA and the Bash install check call belowThreshold(agent, severity) for each finding.
  2. belowThreshold now asks the new thresholdApplies(agent) instead of switchesApply(agent).
  3. thresholdApplies returns true for every agent switchesApply covers, plus Codex.
  4. defaultThresholdRank uses the same check, so Codex falls back to high when the setting is blank, missing or invalid.

Important

Codex gets only the severity threshold. switchesApply and secretsApply are unchanged, so Codex still ignores the scanner on/off switches and does not run secret detection. The Codex plugin has no secrets skill, so enabling secret detection there would block writes with instructions the agent cannot follow.

cx_severity_threshold (Codex) Blocks
not set, blank, invalid, high Critical, High
critical Critical
medium Critical, High, Medium
low Critical, High, Medium, Low

Unchanged: Claude, Copilot, Droid and Windsurf; Cursor and Gemini still ignore the threshold. Malicious packages and an empty severity still always block; None/Unknown still never block (from #1626).

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Related Issues

Validation

  • Test approach: TDD was not established from available evidence.
  • Unit tests: go test -count=1 ./internal/commands/agenthooks/... — passed. New tests cover the Codex default, each threshold value, an invalid value and an empty severity; existing tests still check that Codex ignores the scanner switches and secret detection.
  • Integration tests: Not run — no integration test covers agent hooks; this needs a real Codex CLI session.
  • Performance tests: Not applicable — one extra boolean check per finding.
  • Lint: golangci-lint run -c .golangci.yml ./internal/commands/agenthooks/cx/... — no findings on changed lines.

Documentation updates

  • None required in this repository: the setting has no CLI flag or help text. User documentation for Codex is in cx-agentic-ai #47.

Checklist

  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules
  • I have updated the CLI help for new/changed functionality in this PR (if applicable)
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used

Additional Notes

Merge #1626 first. The Codex plugin's minimum cx version has not been bumped yet, because the release number is not known.

🤖 Generated with Claude Code

… default

Add thresholdApplies: the agents switchesApply covers, plus Codex. Codex
now honours cx_severity_threshold (default high: only Critical and High
block) without also getting the scanner switches or the secrets engine,
which switchesApply and secretsApply still control.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
// thresholdApplies reports whether cx_severity_threshold is honoured for this agent: every agent
// switchesApply covers, plus Codex. It is separate from switchesApply so Codex gets the severity threshold
// without the scanner switches and the secrets engine. Add an agent here to give it the threshold only.
func thresholdApplies(agent agenthooks.AgentID) bool {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a separate check: switchesApply gates three things, and Codex should get only one of them.

switchesApply   -> scannerOn     (scanner on/off switches)
                -> secretsApply  (secret detection engine)
thresholdApplies -> belowThreshold, defaultThresholdRank

Removing Codex from switchesApply would also start secret detection for Codex. Its deny tells the agent to use cx-devassist-secrets, which the Codex plugin does not have. To give another agent the threshold only, add it here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant