Skip to content

fix(claude-security-review): mitigate absent required check (#227) - #440

Merged
kyle-sexton merged 5 commits into
mainfrom
cursor/issue-227-security-check-mitigation-9b36
Aug 12, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
cursor/issue-227-security-check-mitigation-9b36

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Aug 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Mitigate intermittent absent security-review required checks so bot-opened PRs are not permanently blocked when event delivery gaps leave the check missing.

Related

Fixes #227

Fix

  • Fail-open / mitigation path for absent required security-review checks after a grace window
  • Self-test workflow and contract tests for the mitigation script
  • Docs for the absent-check mitigation posture

Verification

  • node --test on security-review dispatch / fail-closed / absent-mitigate tests
  • Biome CI-equivalent check on .github/scripts
  • Note: editing the security-review caller workflow can chicken-egg the required check until this lands (admin squash if needed)

@cursor

cursor Bot commented Aug 12, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@kyle-sexton
kyle-sexton enabled auto-merge (squash) August 12, 2026 06:24
@claude

claude Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 3m 35s —— View job


Code review — PR #440

  • Gather context (CLAUDE.md, REVIEW.md, diff)
  • Review workflow changes (claude-security-review.yml, claude-security-review-self.yml)
  • Review new mitigation workflows (security-review-absent-mitigate*.yml)
  • Review new script security-review-absent-mitigate.cjs
  • Review test coverage
  • Review docs/README updates
  • Post findings

This is a well-documented, carefully reasoned change (workflow_dispatch + pr-number re-entry, a new security-review-absent-mitigate.cjs extending the existing check-run-reconcile taxonomy, and companion schedule workflows). Per REVIEW.md, security-scope findings are left to the dedicated security lane; this pass covers correctness, error handling, and maintainability. I posted 3 inline comments:

  1. Important — grace-period anchor bug (security-review-absent-mitigate.cjs:446): pastGracePeriod is anchored to the PR's created_at, not to when the current head SHA was pushed. It's documented as preventing a race with a healthy pull_request delivery, but created_at never changes on synchronize — so for any PR older than graceMinutes (the common case), a fresh push is immediately treated as "past grace," and the companion (default mode post-failure-check, cron every ~15 min) can post a spurious FAILED check or fire a redundant dispatch while the legitimate review for that head is still running. No added test exercises an old PR + fresh SHA combination.
  2. Suggestion — dead output (claude-security-review.yml:892): the new resolve-pr step computes and emits a draft output that's never consumed anywhere downstream.
  3. Suggestion — unguarded null payload (security-review-absent-mitigate.cjs:312): collectCheckRuns/collectWorkflowJobs dereference payload.* without the null-guard listOpenPulls uses for the same ghApiJson contract, so an empty response throws a raw TypeError instead of the domain MitigateUsageError.

Note on verification: I could not execute node --test in this sandbox (Bash tool calls here require approval that isn't available in this flow), so the Test plan's "node --test for mitigate + dispatch + fail-closed scripts" is author-claimed and unverified by me — I reviewed the test files' contents and logic by reading, not by running them.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

&& (github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name == github.repository) }}

P1 Badge Reject fork PRs before dispatching the secret-bearing review

When mode=dispatch processes an absent check on a fork PR, the companion includes it in the unfiltered open-PR scan (security-review-absent-mitigate.cjs:392-411) and dispatches it (:545-552), but this condition applies the fork guard only to pull_request events. The dispatched run therefore checks out the resolved fork SHA and invokes Claude with CLAUDE_CODE_OAUTH_TOKEN, allowing fork-controlled files and instructions to run in a secret-bearing context—the exact exposure the normal pull_request guard prevents. Reject a resolved head-repo that differs from github.repository before checkout/action execution.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

cursoragent and others added 2 commits August 12, 2026 06:28
Intermittent pull_request event-delivery gaps can leave the required
security-review / security-review context ABSENT (not failed), blocking
merge on requires-security-review=true repos.

- Add workflow_dispatch + pr-number re-entry on the security dogfood caller
  and reusable (resolve-pr / freshness / checkout / prompts), without moving
  the lane onto privileged pull_request_target or workflow_run.
- Add security-review-absent-mitigate.cjs (extends check-run-reconcile) plus
  schedule/dispatch companion workflows that post a FAILED visibility check
  or re-dispatch the caller.
- Document the mitigation for consumers.

Fixes #227

Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Claude has reviewed this PR 1 time. The lane skips further automatic reviews after 5; deleting this comment resets the count.

Clear MD004 on the companion docs note and keep the shebang script
executable in the git index for the hygiene exec-bit gate.

Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
@kyle-sexton
kyle-sexton force-pushed the cursor/issue-227-security-check-mitigation-9b36 branch from 644281b to afdefb8 Compare August 12, 2026 06:29
cursoragent and others added 2 commits August 12, 2026 06:29
Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
Address review on #440 / #227:
- workflow_dispatch with --ref=PR head so the check attaches to the head SHA
- grace window anchors to sibling check activity / head commit time, not PR
  created_at (so synchronize pushes are not raced)
- null-safe Checks/Actions payloads

Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
@kyle-sexton
kyle-sexton merged commit 433b9da into main Aug 12, 2026
1 check passed
@kyle-sexton
kyle-sexton deleted the cursor/issue-227-security-check-mitigation-9b36 branch August 12, 2026 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants