Repository navigation
fix(ci): fail the Agent Security Scan job at high severity - #1448
Conversation
The scanner's --min-severity only filters its report and it exits non-zero only for critical findings, so a high finding passed this job despite the comment saying otherwise. Write the JSON report to RUNNER_TEMP, treat exit 2 as "critical findings in the report", and enforce the threshold with the shared severity gate from #1436. ci-tests.yml now also runs when the gate lib changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Dev-Lead — waiting on PR blockers (intent: review-changes)PR: #1448 |
|
Note @don-petry I reviewed this PR and no code changes were needed, but I can't mark it done yet: required check |
|
No description provided. |
|
This is an operational notice indicating that the Codex code review failed to complete, not a specific code finding. All CI checks pass with no actionable defects identified. |
Dev-Lead — fix-bot-comment (no-changes)Agent reasoning |
|
No description provided. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
No description provided. |
|
No description provided. |
|
No description provided. |
|
No description provided. |
This comment has been minimized.
This comment has been minimized.
Dev-Lead — fix-reviews (no-changes)Agent reasoning |
|
No description provided. |
|
|
No description provided. |
|
No description provided. |
|
Re-read the current CodeRabbit summary (edited after my earlier disposition). It reports no actionable comments, all 5 pre-merge checks passed, merge risk minimal, and no Security Architecture, outside-diff, or nitpick findings. Nothing to change. |
Dev-Lead — fix-reviews (no-changes)Agent reasoning |
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: MEDIUM
Reviewed commit: b28e2f092aad18e7e2485724369ba9a548c802d0
Review mode: triage-approved (single reviewer)
Summary
I agree with the triage result (MEDIUM, logic). The PR fixes a real gap: ecc-agentshield scan --min-severity high only filters the report and exits non-zero only for critical findings, so a high finding used to pass the Agent Security Scan job. The fix:
- Writes the report to
$RUNNER_TEMP/agentshield-report.json. Exit0or2(2 means critical findings) goes on to the gate. Any other exit fails the step with the scanner's own exit code. - Adds an Enforce AgentShield severity threshold step that sources the existing shared
.github/scripts/agent-shield/lib/severity-gate.sh. The PR adds no new decision logic. - Sets the threshold once, as job-level
AGENTSHIELD_MIN_SEVERITY: high. - Adds
.github/scripts/agent-shield/**to theci-tests.ymlpath filters, so the suite re-runs when the gate lib changes.
This tightens a security control and does not weaken one.
Linked issue analysis
No issue is linked. The PR body says the job previously passed high-severity findings, which matches the scanner behaviour the diff describes, and points to the earlier reusable-workflow fix (#1438). I treated the linked-issue gate as not applicable.
Findings
No blocking findings.
Correctness:
cmd > file || scan_rc=$?together with${scan_rc:-0}works under the runner's defaultbash -e -o pipefail. The||stops-efrom aborting before thecaseruns, and an unsetscan_rcmeans success.- Only stdout goes to the report file. npm/npx stderr noise stays out of the JSON.
- An empty or missing report fails at the gate, and the bats suite tests this.
- The bats suite pulls the real
run:scripts out ofci.ymlwithyqand runs them against a stubbednpx, each in its ownbash -e. That gives real regression coverage, not a copy of the logic. It covers: a high finding with exit 0 fails; a critical finding with exit 2 fails; medium or clean passes; exit 4 fails with code 4; an empty report fails; the npx flags are kept.
Security (GitHub Actions):
- Job permissions are still
contents: read. - No new actions, secrets or untrusted
${{ }}interpolation inrun:steps. npx --ignore-scriptsand the pinnedecc-agentshield@1.4.0are kept, and a test asserts both flags.- The safety checks reported nothing: no CI weakening, no secrets in run steps, no third-party reusables.
Non-blocking nits:
- The issue references don't match. The code comments and commit message cite
#1436, the PR body cites#1438. Possibly one is the issue and one the PR; worth making consistent. - I could not see whether the
ci-tests.ymlpath filters already include.github/workflows/ci.ymlandtest/workflows/ci/**; the diff context doesn't show the full list. If they don't, edits to the job or the new bats file would not trigger the suite. Unconfirmed.
What I could not check:
- The shared lib
severity-gate.shisn't in my local checkout, so I couldn't read it. Indirect evidence suggests it exists and works: Agent Security Scan passed at this head SHA, which means the sourced lib loaded and the real report parsed underbash -e, and thebatscheck passed. - The MCP secret scan was unavailable in this run and was skipped.
- I did not run
shellcheckorbatsmyself. I'm relying on the CI results.
Review state: there are no unresolved review threads and no human-reviewer questions. CodeRabbit approved at this head SHA. All bot comments (Codex and CodeRabbit rate-limit notices) were marked informational.
CI status
All required checks passed at b28e2f0: Lint, ShellCheck, Agent Security Scan, Secret scan (gitleaks), CI Workflow Tests bats, Dependency Hardening Tests bats, CodeQL (actions, python and the aggregate), SonarCloud (Quality Gate passed with 0 new issues), the Dependency audit gate, AgentShield and duplicate-decl-gate. The earlier CodeQL failure mentioned in Dev-Lead comments was on an older SHA and is green now. The only CANCELLED checks are three Dev-Lead jobs (dispatch, ci-relay, resume). Later runs replaced them: dispatch and resume succeeded, and ci-relay was skipped. Other SKIPPED checks don't apply to this repo (cargo, pip, pnpm, govulncheck, dependabot).
Reviewed automatically by the PR-review agent (single-reviewer mode: opus 5.5 [opus 4.8, opus 4.7]). Reply if you need a human review.
|
pr-review approved on PARTIAL advisory evidence: 1/5 required advisory bots reported before the gate's head-age-timeout fallback proceeded. Recorded for the miss-rate metric (#1596). |



Summary
The Agent Security Scan job in
ci.ymlranecc-agentshield scan --min-severity highand relied on its exit code. The scanner's--min-severityonly filters the report, and it exits non-zero only for critical findings, so a high-severity finding passed the job. This is the same issue fixed for the AgentShield reusable in #1438.$RUNNER_TEMP. Exit 2 (critical findings in the report) is left to the gate, and any other non-zero exit fails the job as a scanner error..github/scripts/agent-shield/lib/severity-gate.shfrom fix(agent-shield): fail at the configured min-severity (#1436) #1438. No new decision logic.AGENTSHIELD_MIN_SEVERITY: high.ci-tests.ymlalso runs when.github/scripts/agent-shield/**changes, because the ci suite now depends on the gate lib.The latest main scan reported 0 findings, so this PR is not expected to change any current result.
Tests
test/workflows/ci/agent-security-gate.batsruns the job's real steps fromci.ymlagainst a stubbednpx:--ignore-scripts,--format json,--min-severity highLocal:
bats test/workflows/ci/passes 30/30.actionlintandshellcheckare clean.🤖 Generated with Claude Code
Problem
See the linked issue.
Risk
Medium — changes GitHub Actions workflow behavior, which is exercised only post-merge; verify via the affected workflow runs.
Test plan
Tests added/updated:
test/workflows/ci/agent-security-gate.bats. Verification:bash scripts/dev-lead-lint.sh(shellcheck --severity=warning) ran pre-commit; the bats suite runs in CI.Rollback
Revert this PR. No non-revertible side effects (no tags, migrations, or external state).
Monitoring
Watch the affected workflow run(s) in the Actions tab and this PR's Lint check for regressions.