Repository navigation
Trust same-repository bot PRs triggered by labels - #72074
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
Updated RS-05a and the compiler threat-model mapping, extended the checkout TLA+ model for |
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Request changes
The new trust exception broadens privileged PR-head checkout to labeled events without preserving the prior metadata-event boundary. A bot/app able to add labels but lacking collaborator code-execution permission can now trigger checkout of arbitrary PR code under the workflow's permissions. See the inline comment for the required narrowing or justification.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
| const { ERR_API, ERR_PERMISSION } = require("./error_codes.cjs"); | ||
| const TRUSTED_CHECKOUT_PERMISSIONS = ["write", "maintain", "admin"]; | ||
| const TRUSTED_BOT_PR_ACTIONS = ["opened", "synchronize", "ready_for_review", "reopened"]; | ||
| const TRUSTED_BOT_PR_ACTIONS = ["opened", "synchronize", "ready_for_review", "reopened", "labeled"]; |
There was a problem hiding this comment.
Adding labeled to this allowlist lets a same-repository bot/app bypass collaborator verification on a metadata-only event, so an actor that can add labels but is not trusted for code execution can cause the workflow to fetch and execute arbitrary PR head code with its existing permissions.
💡 Why this matters
The previous test explicitly treated labeled as an untrusted action, and label mutation generally requires less repository authority than creating or updating PR code. Either preserve the permission check for labeled, or constrain this exception to a verifiable, narrowly scoped trusted label-routing path and document that security decision next to the allowlist.
There was a problem hiding this comment.
Removed labeled from TRUSTED_BOT_PR_ACTIONS; same-repository label events now use the collaborator permission check. Added fail-closed coverage for both PR event types and aligned the RS-05a docs/model. Commit: 72ce6eb.
There was a problem hiding this comment.
🔵 Needs a closer look
The change expands a security-sensitive checkout exception while formal revalidation remains pending.
2 open issues
What changed in this PR
Extends gh-aw’s PR checkout trust exception to label-triggered, same-repository bot PRs, addressing #71151 while preserving sender and repository-identity checks.
Changes:
- Adds
labeledto trusted bot actions forpull_requestandpull_request_target. - Adds positive and fail-closed regression cases for both triggers.
- Updates security specifications, validation records, and the bounded authorization model.
| File | Description |
|---|---|
specs/workflow-security/README.md |
Documents labeled in checkout-model coverage. |
specs/workflow-security/CommentTriggeredPRCheckout.tla |
Adds labeled to modeled and supported actions. |
specs/security-architecture-spec.md |
Updates the normative exception and version history. |
specs/security-architecture-spec-validation.md |
Updates coverage mapping and validation status. |
specs/compiler-threat-detection-spec.md |
Clarifies the runtime exception’s scope. |
specs/compiler-threat-detection-changelog.md |
Records the clarification and mapping audit. |
actions/setup/js/checkout_pr_branch.test.cjs |
Covers trusted labeled events and rejected provenance cases. |
actions/setup/js/checkout_pr_branch.cjs |
Extends the trusted bot action allowlist. |
Review effort: Max
| ## Executive Summary | ||
|
|
||
| ⚠️ **VALIDATION STATUS**: The specification reflected the implementation at the time of full validation on 2026-07-15 and RS-05a targeted revalidation on 2026-10-09. The v1.1.2 review-checkout update and v1.1.3 branch-event update have not yet received targeted revalidation (see §7b); this document does not claim that they have. These validations do not replace the full revalidation required by the policy in `security-architecture-spec.md` §11. | ||
| ⚠️ **VALIDATION STATUS**: The specification reflected the implementation at the time of full validation on 2026-07-15 and RS-05a targeted revalidation through v1.1.5 on 2026-10-26. The v1.1.2 review-checkout update and v1.1.3–v1.1.5 branch-event updates have not yet received full formal revalidation (see §7b); this document does not claim that they have. These validations do not replace the full revalidation required by the policy in `security-architecture-spec.md` §11. |
There was a problem hiding this comment.
Restored the last completed targeted formal revalidation to v1.1.1 / 2026-10-09. The validation summary now separates runtime evidence for v1.1.3 and v1.1.5 and identifies v1.1.4 as transport-security work. Commit: 72ce6eb.
| | bot/app actor with write-or-higher repository permission allowed | actor trust | | ||
| | bot/app actor without write-or-higher repository permission rejected for `workflow_dispatch`, `issue_comment`, `pull_request_review_comment`, and `pull_request_review` | actor trust | | ||
| | same-repository bot `opened`, `synchronize`, `ready_for_review`, and `reopened` PR events allowed only when sender and runtime, head, and base repository IDs match; `ready_for_review` and `reopened` are lifecycle actions, not branch-push evidence | actor trust exception | | ||
| | same-repository bot `opened`, `synchronize`, `ready_for_review`, `reopened`, and `labeled` PR events allowed only when sender and runtime, head, and base repository IDs match; lifecycle/metadata actions are not branch-push evidence | actor trust exception | |
There was a problem hiding this comment.
Because labeled now stays outside the trusted bypass after the security fix, I kept the actual trusted action list limited to opened, synchronize, ready_for_review, and reopened, and updated the negative-case wording to name labeled and edited as actions outside that allowlist. Commit: 72ce6eb.
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd — this is a clean, well-scoped fix. APPROVE.
📋 Analysis
What was checked
- Trust boundary preserved:
labeledwas added toTRUSTED_BOT_PR_ACTIONSinside the same same-repository check that already requiressender.type === "Bot",sender.login === actor, and positive, equal runtime/head/base repository IDs. Forked PRs and identity mismatches still fall through to the collaborator-permission check — no new bypass surface. - Root cause addressed, not just symptom: this closes the exact gap described in #71151 (same class as #69311), extending the existing exception to the one remaining lifecycle action that previously forced a failing
getCollaboratorPermissionLevelcall for App senders. - Test coverage (
/tdd): positive cases added forlabeledon bothpull_requestandpull_request_target; negative/fail-closed cases added for forked PR, mismatched base repo ID, different sender, and non-bot sender underlabeled. The pre-existing"metadata-only PR event"negative case was correctly renamed to"untrusted PR action"(usingedited) sincelabeledmoved into the trusted set — this avoids a stale/contradictory test name. - Docs/spec consistency:
security-architecture-spec.md(v1.1.4→v1.1.5), its changelog, the validation doc, and theCommentTriggeredPRCheckout.tlaformal model were all updated in lockstep with the code change, keeping the bounded TLA+ coverage honest.
Minor observations (non-blocking)
- Could not execute
npm/vitestin this sandbox (no network access to the registry), so the new test cases were verified by static reading only, not by running the suite. The logic and assertions read correctly and mirror the existingready_for_review/reopenedpatterns exactly.
Positive highlights
- ✅ Symmetric test matrix across
pull_requestandpull_request_targetfor every new negative case - ✅ Spec, changelog, validation doc, and TLA+ model updated together — no doc drift
- ✅ No widening of the exception beyond the single lifecycle action needed to fix the bug
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · ~69 AIC · ⌖ ~15 AIC · ⊞ 10.2K
Comment /matt to run again
|
@copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef head: 30f20ec
|
…ranch-bot-exception Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
@copilot fix ci failures |
…ranch-bot-exception Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed the CJS shard failure in
Merged latest |
|
🎉 This pull request is included in a new release. Release: |

GitHub App actors on same-repository PRs can receive
nonefrom the collaborator-permission endpoint, causing label-triggered checkout to fail. Extend the existing same-repository bot exception tolabeledevents.pull_requestandpull_request_target, including fail-closed cases.