Skip to content

fix(ci): fail the Agent Security Scan job at high severity - #1448

Merged
don-petry merged 6 commits into
mainfrom
claude/strange-thompson-522801
Nov 3, 2026
Merged

don-petry merged 6 commits into
mainfrom
claude/strange-thompson-522801

Conversation

@don-petry

@don-petry don-petry commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Agent Security Scan job in ci.yml ran ecc-agentshield scan --min-severity high and relied on its exit code. The scanner's --min-severity only 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.

  • The scan step writes the JSON report to $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.
  • A new Enforce AgentShield severity threshold step sources .github/scripts/agent-shield/lib/severity-gate.sh from fix(agent-shield): fail at the configured min-severity (#1436) #1438. No new decision logic.
  • The threshold is set once, as the job-level AGENTSHIELD_MIN_SEVERITY: high.
  • ci-tests.yml also 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.bats runs the job's real steps from ci.yml against a stubbed npx:

Case Expected
exit 0 with a high finding job fails
exit 2 with a critical finding job fails, finding listed
medium finding, or a clean report job passes
scanner exit 4 job fails with exit 4
empty report job fails
npx args keep --ignore-scripts, --format json, --min-severity high

Local: bats test/workflows/ci/ passes 30/30. actionlint and shellcheck are clean.

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

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.

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>
@don-petry
don-petry requested a review from a team as a code owner November 3, 2026 03:26
@chatgpt-codex-connector

This comment has been minimized.

@coderabbitai

This comment has been minimized.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — waiting on PR blockers (intent: review-changes)

PR: #1448
No changes were committed, but the PR still can't be marked done: required check CodeQL is failing. The retry cron will re-attempt automatically. Next attempt after: 2026-11-03T04:06:09Z

@don-petry

Copy link
Copy Markdown
Contributor Author

Note

@don-petry I reviewed this PR and no code changes were needed, but I can't mark it done yet: required check CodeQL is failing. I'll re-check automatically.
Next attempt after: 2026-11-03T04:06:09Z

@don-petry
don-petry enabled auto-merge (squash) November 3, 2026 03:36
@donpetry-bot

donpetry-bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

@don-petry
don-petry disabled auto-merge November 3, 2026 04:00
@don-petry

Copy link
Copy Markdown
Contributor Author

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.

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
**Bot:** `chatgpt-codex-connector[bot]`
**Issues addressed:** 0 (operational notice only)
**Finding:** Codex review failed to complete — this is a non-actionable operational notice, not a code defect or finding.
**Action taken:** Dispositioned the original comment as `informational` since:
- No specific code issues are reported
- All CI checks pass with no failures or Tier 1 blockers
- The comment merely indicates a review operation failed, not a substantive code problem
**Files changed:** None
**Disposition reply posted:** https://github.com/combsmith/.github/pull/1448#issuecomment-6595111589
The PR is now clear of bot comment blockers. The harness will minimize the comment RESOLVED once the push succeeds.

@don-petry
don-petry enabled auto-merge (squash) November 3, 2026 04:01
@donpetry-bot

Copy link
Copy Markdown
Contributor

No description provided.

@don-petry
don-petry disabled auto-merge November 3, 2026 11:15
@don-petry

This comment has been minimized.

@don-petry

This comment has been minimized.

@don-petry
don-petry enabled auto-merge (squash) November 3, 2026 11:16
@don-petry

Copy link
Copy Markdown
Contributor Author

No description provided.

@don-petry

Copy link
Copy Markdown
Contributor Author

No description provided.

@don-petry

Copy link
Copy Markdown
Contributor Author

No description provided.

@don-petry

Copy link
Copy Markdown
Contributor Author

No description provided.

@don-petry
don-petry disabled auto-merge November 3, 2026 16:19
@don-petry

This comment has been minimized.

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-reviews (no-changes)

Agent reasoning
Addressed 0 review threads, because none were open. I posted one fresh disposition for the stale CodeRabbit comment.
- **Comment `IC_kwDORyesfc8AAAABiRK5HA` (coderabbitai):** I re-read the edited body and posted an `informational` disposition (https://github.com/combsmith/.github/pull/1448#issuecomment-6609346583). The body contains no findings. It has the "Review limit reached" rate-limit notice, a run-configuration/commits/files list, the Autofix checkbox and the Verify invitation. There is no Security Architecture Review section, no actionable, outside-diff or nitpick counts, and no severity-labelled items.
- **CI and reviews:** all CI checks passed or were skipped, and there are no `CHANGES_REQUESTED` reviews, so there were no Tier 1 blockers.
- **Test verification:** not run, because I made no code changes.
- **Files changed:** none.

@don-petry
don-petry enabled auto-merge (squash) November 3, 2026 16:20
@don-petry

Copy link
Copy Markdown
Contributor Author

No description provided.

@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@don-petry

Copy link
Copy Markdown
Contributor Author

No description provided.

@don-petry

Copy link
Copy Markdown
Contributor Author

No description provided.

@don-petry
don-petry disabled auto-merge November 3, 2026 19:37
@don-petry

Copy link
Copy Markdown
Contributor Author

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.

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-reviews (no-changes)

Agent reasoning
Addressed 0 threads. There were no open review threads, so I made no code changes and no commits.
- **Stale disposition:** I re-read the edited CodeRabbit summary comment (`IC_kwDORyesfc8AAAABiRK5HA`). It reports no actionable comments, all 5 pre-merge checks passed, and minimal merge risk. It has no Security Architecture, outside-diff, or nitpick findings. I posted a fresh `informational` disposition on the PR to replace the stale one.
- **CI and reviews:** The only reviewer state is the CodeRabbit APPROVED review, so there are no `CHANGES_REQUESTED` blockers. Of the CI checks, `dev-lead / dispatch` was still `in_progress` when the check list was captured. A second `dev-lead / dispatch` run is `cancelled`. It sits next to the in-progress run of the same job, so it looks superseded and I did not treat it as a blocker.
- **Test verification:** I didn't run the test suite, because nothing changed.
Files changed: none.

@don-petry
don-petry enabled auto-merge (squash) November 3, 2026 19:37

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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. Exit 0 or 2 (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 the ci-tests.yml path 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 default bash -e -o pipefail. The || stops -e from aborting before the case runs, and an unset scan_rc means 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 of ci.yml with yq and runs them against a stubbed npx, each in its own bash -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 in run: steps.
  • npx --ignore-scripts and the pinned ecc-agentshield@1.4.0 are 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.yml path filters already include .github/workflows/ci.yml and test/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.sh isn'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 under bash -e, and the bats check passed.
  • The MCP secret scan was unavailable in this run and was skipped.
  • I did not run shellcheck or bats myself. 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.

@donpetry-bot

Copy link
Copy Markdown
Contributor

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).

@don-petry
don-petry merged commit 78e4885 into main Nov 3, 2026
39 of 42 checks passed
@don-petry
don-petry deleted the claude/strange-thompson-522801 branch November 3, 2026 23:38
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.

2 participants