Skip to content

Add option to allow bots reviewing bot code - #68

Merged
masih merged 2 commits into
mainfrom
masih/allow-bot-review-but-by-bot
Aug 28, 2026
Merged

Add option to allow bots reviewing bot code#68
masih merged 2 commits into
mainfrom
masih/allow-bot-review-but-by-bot

Conversation

@masih

@masih masih commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Concrete usecase for this is the backport PR AI review authored by bots.

Concrete usecase for this is the backport PR AI review authored by bots.
@cursor

cursor Bot commented Aug 28, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Expands who can trigger paid re-review runs; misconfigured allowlists could let unintended bots invoke reviews, though default [] keeps prior bot-deny behavior.

Overview
Adds an allowed-bots workflow input (default empty JSON array) so trusted GitHub bots—not only humans on allowed-team—can trigger another AI review with an exact @seidroid review comment. This supports flows like bot-authored backport PRs that need a follow-up review.

Preflight no longer drops all bot comment/review events: bots whose login appears in the parsed allowlist can enter the pipeline; others stay blocked before runners start. Authorization in the resolve step branches on user.type: bots match case-insensitive exact logins from the JSON array; non-bots still require active org team membership, with the same fail-closed behavior on empty/invalid config.

The seidroid AI review README documents the new input, example caller config, and updated security notes. The assistant workflow is unchanged and still ignores bot comments.

Reviewed by Cursor Bugbot for commit 67d7fbf. Bugbot is set up for automated code reviews on this repo. Configure here.

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

Adds an allowed-bots allowlist so specific bot logins can request re-reviews; the authorization logic in resolve fails closed correctly (empty allowlist denies all bots, fork PRs still can't request explicit re-reviews, humans still go through the team check). The one concern is that removing user.type != 'Bot' from the preflight if: drops the cheap pre-filter for all bots rather than just non-allowlisted ones, so denied bot events — including seidroid's own reviews — now consume a preflight job.

Findings: 0 blocking | 3 non-blocking | 1 posted inline

Blockers

  • None at the file/PR level.

Non-blocking

  • Security docs: allowlisting a bot effectively grants re-review triggering to anyone who can make that bot post a comment (e.g. github-actions[bot] can be driven by any workflow in the repo). Worth one sentence in the README security section telling operators to only list bots whose comment bodies are not attacker-controlled.
  • Comment drift: the block comment above the resolve step (.github/workflows/ai-review.yml:200-202) still says further reviews "require an exact command from an active member of allowed-team"; it was not updated for the new bot-allowlist path, unlike the preflight comment.
  • 1 suggestion(s)/nit(s) flagged inline on specific lines.

Comment thread .github/workflows/ai-review.yml
@alexander-sei
alexander-sei self-requested a review August 28, 2026 10:35
@masih

masih commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator Author

@seidroid review

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

The bot allowlist is implemented correctly and fails closed at every layer (an empty array denies all bots, forks still cannot request explicit re-reviews, humans still go through the team check), and it resolves the earlier preflight-filter finding. The remaining notes are documentation and defensive-parsing polish.

Findings: 0 blocking | 3 non-blocking | 2 posted inline

Blockers

  • None at the file/PR level.

Non-blocking

  • Comment drift: the block comment above the resolve step (.github/workflows/ai-review.yml:213-215) still says further reviews "require an exact command from an active member of allowed-team" and that "Membership lookup failures deny access" — it was not updated for the new bot-allowlist path, unlike the preflight comment above it.
  • 2 suggestion(s)/nit(s) flagged inline on specific lines.

ignores it. Human re-review requests are accepted only from active members of
`allowed-team`; bot requests require an exact, case-insensitive login match in
the `allowed-bots` JSON array. Non-allowlisted bots are rejected before a runner starts.
Membership lookup errors and empty allowlists fail closed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[suggestion] This documents the mechanism but not its trust consequence: allowlisting a bot effectively grants re-review triggering to anyone who can make that bot post a comment. github-actions[bot], for example, can be driven by any workflow in the repo, so allowlisting it delegates the trigger to anyone who can add or modify a workflow. Worth one sentence telling operators to only list bots whose comment bodies are not attacker-controlled.

} catch (error) {
core.notice(`Could not verify active membership for ${actor} in ${team}; denying request.`);
if (actorType === "Bot") {
const configuredBots = JSON.parse(process.env.ALLOWED_BOTS || "[]");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nit] JSON.parse is unguarded while the very next lines defensively handle a non-array result — the asymmetry is odd, since a malformed allowed-bots string is the more likely operator error and it throws here, failing the step rather than denying cleanly with a notice. A try/catch defaulting to [] (plus a core.notice) would match the fail-closed style used for the allowed-team branch.

Relatedly, fromJSON(inputs.allowed-bots) in the preflight if: has no fallback at all, so a malformed value errors the expression for any bot-authored comment event.

@masih
masih merged commit 68010d0 into main Aug 28, 2026
13 of 15 checks passed
@masih
masih deleted the masih/allow-bot-review-but-by-bot branch August 28, 2026 11:32
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