Skip to content

docs: add roles: as security-critical pattern in gh-aw skill#724

Closed
PureWeen wants to merge 2 commits intomainfrom
fix/skill-roles-pattern
Closed

docs: add roles: as security-critical pattern in gh-aw skill#724
PureWeen wants to merge 2 commits intomainfrom
fix/skill-roles-pattern

Conversation

@PureWeen
Copy link
Copy Markdown
Owner

Feedback from jonathanpeppers: roles: is security-critical and was missing from the SKILL.md quick-reference. Also presents REQUEST_CHANGES as a valid option with tradeoffs.

Feedback from jonathanpeppers on the blog post: roles: is
security-critical and was missing from the quick-reference
patterns section. Without it, any user (including the PR author)
can trigger /review on a malicious PR.

Also updated allowed-events guidance to present both COMMENT-only
and REQUEST_CHANGES as valid options with tradeoffs, rather than
only recommending COMMENT.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

📋 Design-Level Finding (Outside Diff)

🟡 MODERATE — Anti-patterns table has no entry for roles: allowlist (Flagged by: 2/3 reviewers after follow-up verification)

The anti-patterns table (~line 60) has an entry for skip-roles: ("Manual if: to skip by author role") but nothing for roles:. These are distinct fields with different security semantics: skip-roles: excludes specific roles; roles: is a positive allowlist gate. Since this PR elevates roles: to Security-Critical Pattern #1, consider adding a complementary anti-pattern row (e.g., "Manual if: to check actor role before executing → roles: under on:") to improve discoverability for developers scanning the table first.

Generated by Expert Code Review (auto) for issue #724 · ● 5.8M ·

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Expert Code Review — PR #724

Methodology: 3 independent reviewers with adversarial consensus. Disputed findings (flagged by only 1 reviewer) were escalated to the other 2 for verification before inclusion or discard.

Findings (ranked by severity)

# Severity Finding Consensus
1 🟡 MODERATE Pattern #1 description overstates risk of omitting roles: — the default is already [admin, maintainer, write] per architecture.md, so omission is not a security gap 2/3 reviewers
2 🟡 MODERATE Pattern #2's commented REQUEST_CHANGES alternative contradicts the anti-patterns table in the same document 2/3 reviewers
3 🟡 MODERATE Anti-patterns table has no entry for roles: allowlist to complement new Pattern #1 (outside diff — posted as design-level comment) 2/3 reviewers (after follow-up)

Discarded Findings (single reviewer only)

  • roles: YAML indentation wrong — Both follow-up reviewers confirmed on.roles: is a sibling of slash_command: under on:, matching architecture.md's "Authorization Model (on.roles:)" notation. The PR's indentation is correct.
  • Pattern #2 omits "no dismiss safe output" detail — Both follow-up reviewers agreed that "manually dismissed" sufficiently communicates the risk for a quick-reference pattern, with deeper details available in architecture.md.

Context

  • CI Status: pre_activationactivationagent 🔄 in progress (this review)
  • Prior Reviews: None
  • Scope: Documentation-only change (1 file, 19 additions, 6 deletions)
  • Test Coverage: N/A — no code changes; renumbering is internally consistent with no broken cross-references

Overall Assessment

This is a valuable security documentation improvement — adding roles: as a first-class security-critical pattern addresses a real gap in the quick-reference. The two inline findings are about documentation accuracy relative to architecture.md and internal consistency within the same file. Neither represents a security regression in the advice given.

Generated by Expert Code Review (auto) for issue #724 · ● 5.8M


**1. Prevent accidental PR approvals** — always restrict review workflows; otherwise the agent can approve PRs and bypass branch protection rules (gh-aw#25439). Use `[COMMENT]` to avoid stale blocking reviews that can't be dismissed:
**1. Role-based access control** — the `roles:` field controls who can trigger the workflow. Without it, any user (including the PR author) can trigger `/review` on a malicious PR designed to prompt-inject the reviewer:
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.

🟡 MODERATE — Description overstates the risk of omitting roles: (Flagged by: 2/3 reviewers)

The text says "Without it, any user (including the PR author) can trigger /review on a malicious PR" — but architecture.md documents that on.roles: defaults to [admin, maintainer, write] (§ Authorization Model). Omitting roles: does not leave the workflow open; the default is already the restrictive set.

Failing scenario: A maintainer reads this, audits existing workflows missing explicit roles:, files false-positive security bugs — or worse, hastily adds roles: and accidentally sets a wrong value during the edit.

Suggested fix: Rephrase to reflect the actual default behavior, e.g.:

1. Role-based access controlroles: controls who can trigger the workflow. The default ([admin, maintainer, write]) is secure, but always set it explicitly so it's visible during code review. Never use roles: all on workflows that process PR content — it gives any read-only user access to everything the workflow grants.

Comment on lines +222 to +223
# Or allow REQUEST_CHANGES for stronger merge-gating (but stale reviews persist until manually dismissed):
# allowed-events: [COMMENT, REQUEST_CHANGES]
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.

🟡 MODERATE — Contradicts the anti-patterns table in the same document (Flagged by: 2/3 reviewers)

Presenting REQUEST_CHANGES as a valid alternative here conflicts with the anti-patterns table (~line 68, unchanged by this PR), which says:

allowed-events: [COMMENT] on submit-pull-request-review (prefer over [COMMENT, REQUEST_CHANGES] to avoid stale blocking reviews)

architecture.md also lists "Stale REQUEST_CHANGES reviews" as an explicit anti-pattern. A developer reading Pattern #2 first sees REQUEST_CHANGES as a viable option; a developer reading the anti-patterns table first sees it as something to avoid. The document is now internally inconsistent.

Suggested fix: Either (a) remove the commented-out REQUEST_CHANGES alternative to stay consistent with the anti-patterns table, or (b) update the anti-patterns table to reflect the nuanced tradeoff framing (e.g., "prefer [COMMENT]; use REQUEST_CHANGES only if merge-gating badge is needed — stale reviews require manual dismissal").

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
@PureWeen
Copy link
Copy Markdown
Owner Author

Superseded by #754 which includes this change plus integrity filtering, trigger guide, idempotency, and more.

@PureWeen PureWeen closed this Apr 23, 2026
@PureWeen PureWeen deleted the fix/skill-roles-pattern branch April 23, 2026 19:07
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.

1 participant