Skip to content

feat(delegate): parallel non-blocking security-scanner reviewer - #46

Open
selta-goodparty wants to merge 2 commits into
developfrom
feat/delegate-security-scanner
Open

feat(delegate): parallel non-blocking security-scanner reviewer#46
selta-goodparty wants to merge 2 commits into
developfrom
feat/delegate-security-scanner

Conversation

@selta-goodparty

@selta-goodparty selta-goodparty commented Jun 26, 2026

Copy link
Copy Markdown

What

Adds security-scanner — a second, independent Delegate reviewer that runs in parallel with pr-reviewer and never touches it. On a PR opened/ready_for_review (and on a delegate security review comment) it does an adversarial, diff-scoped security review and posts a non-blocking, comment-only review under its own security-review status context.

pr-reviewer is byte-for-byte unchanged.

Why it can't interfere with the main review

  • Own Fargate task — a second dispatch() per PR, parallel, no shared state.
  • Own GitHub App identity (a third App, distinct login). pr-reviewer reconciles only reviews/threads authored by its own bot login and dedups its status on context == "pr-reviewer"; a different login + the security-review context means it never sees this pass.
  • Never gates merge — only ever event=COMMENT (never APPROVE / REQUEST_CHANGES), and its commit status is always success (informational, not a required check). The main bot's approval still governs mergeability, even if security suggestions are applied.

The analysis

Ported from the /security-scan skill — source→sink taint taxonomy + an adversarial disprove-it verifier — and hardened for this product:

  • First-class LLM / prompt-injection lens (untrusted gov/PDF/web content into LLM tool contexts — the real surface here).
  • First-class infrastructure-as-code lens (Pulumi / Dockerfiles / CI / IAM / security groups), diff-scoped.
  • MITRE ATT&CK technique mapping per finding.
  • Multi-step exploit chains, not just single-line bugs.
  • Opus orchestrator + parallel sonnet finder/verifier subagents. Medium+ post inline with suggestion fixes; Low/info roll into a collapsed summary.

Inert until provisioned (safe to merge now)

Dispatch is gated on the SECURITY_APP_PRIVATE_KEY secret, so nothing fires until the dedicated Delegate Security App exists. To enable (see delegate/README.md):

  1. Register the App (Contents:Read, Pull-requests:R&W, Statuses:R&W), install on omni.
  2. Set SECURITY_APP_ID, SECURITY_INSTALLATION_ID, SECURITY_APP_PRIVATE_KEY.
  3. Deploy. It auto-activates for omni (already in SECURITY_REVIEW_REPOS). Onboarding another repo = install the App + add the name.

Net-new surface

agents/security-scanner.ts (new) · an agents/index.ts import · a SECURITY_REVIEW_REPOS set + dispatch branch + delegate security review trigger in lambdas/github.ts · setupSecurityGitHubAuth in worker/github-auth.ts · a token swap in worker/entrypoint.ts · README docs.

tsc --noEmit clean; all 31 framework/lambda tests pass.

Note: this PR touches delegate/, so the bot self-reviews comment-only — a human merges.


Note

Medium Risk
Touches GitHub webhook dispatch and worker token routing for a new bot identity; misconfiguration could skip scans or post under the wrong App, but pr-reviewer is unchanged and dispatch is secret-gated until provisioned.

Overview
Adds security-scanner, a second Delegate agent that runs in parallel with pr-reviewer on PR opened/ready_for_review and on delegate security review comments. It performs a diff-scoped adversarial security review (taxonomy finders + disprove-it verifiers, CWE/MITRE mapping, LLM/IaC lenses) and posts comment-only reviews with a security-review status that is always success—it does not approve, request changes, or gate merge.

GitHub webhook (delegate/lambdas/github.ts): SECURITY_REVIEW_REPOS (seeded with omni), parallel dispatchSecurityScan after normal PR review dispatch, and a separate re-review path gated on SECURITY_APP_PRIVATE_KEY so the feature stays inert until provisioned.

Worker identity (github-auth.ts, entrypoint.ts): a third GitHub App mints SECURITY_GITHUB_TOKEN; security-scanner jobs exit if that token is missing so reviews never post under the delegate/reviewer identity (avoiding cross-reconciliation with pr-reviewer).

Docs: delegate/README.md documents onboarding the Delegate Security App and repo allowlisting.

Reviewed by Cursor Bugbot for commit cc93dcc. Configure here.

A second, independent reviewer that runs in parallel with pr-reviewer on PR open (and on a 'delegate security review' comment), does an adversarial diff-scoped security review, and posts a non-blocking comment-only review under its own 'security-review' status context. It never approves/requests-changes and its status is always success, so it cannot gate merge — pr-reviewer's approval governs mergeability.

Design: a separate dispatch() per PR = its own Fargate task (parallelism), and its own GitHub App identity (distinct login) so pr-reviewer's login-scoped review/thread reconciliation never sees it — pr-reviewer is byte-for-byte unchanged. Analysis ported from the /security-scan skill (source→sink taint + adversarial disprove-it verifier) with first-class LLM/prompt-injection and IaC lenses, MITRE ATT&CK mapping, and multi-step chain analysis. Medium+ inline with suggestion fixes, Low/info collapsed.

Inert until provisioned: dispatch is gated on the SECURITY_APP_PRIVATE_KEY secret, so this is safe to merge before the Delegate Security App exists. Net-new: agents/security-scanner.ts + an index import + a SECURITY_REVIEW_REPOS set/dispatch branch in lambdas/github.ts + setupSecurityGitHubAuth + a worker token swap. README documents enablement.

@claude claude 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.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit cc93dcc. Configure here.

Comment thread delegate/lambdas/github.ts
Comment thread delegate/agents/security-scanner.ts
Comment thread delegate/lambdas/github.ts Outdated
- Security pass now dispatches on PR open independently of REVIEW_REPOS (shouldDispatchSecurity gates on SECURITY_REVIEW_REPOS alone), so a security-only repo gets the auto pass — matching the documented onboarding.
- Re-trigger (delegate security review) path: agent step 1 now resolves HEAD_SHA via gh api when <headSha> is absent, so re-review statuses target the real SHA instead of empty.
- Dispatch gate now requires all three security config values (key + app id + installation id) so a partial provision stays fully inert instead of dispatching tasks the worker aborts.
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