Skip to content

Commit bccaec4

Browse files
authored
Add integrity-aware warnings for comment and review triggers (#80471)
1 parent d848d46 commit bccaec4

17 files changed

Lines changed: 1039 additions & 14 deletions
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# ADR-80471: Correlate Comment Trigger Warnings with Actor Admission and Integrity Filtering
2+
3+
**Date**: 2026-11-23
4+
**Status**: Proposed
5+
**Deciders**: PR author and repository maintainers (pending review)
6+
7+
## Context
8+
9+
Workflows triggered by `issue_comment`, `pull_request_review`, `pull_request_review_comment`, and the AW `slash_command` and `command` shorthands run on text written by actors that the event and `on.roles` admit. When `on.roles` admits `all`, `read`, or `triage`, that text can come from actors outside trusted repository roles. If the workflow's GitHub tools also use weak integrity filtering (`tools.github.min-integrity: none` or `unapproved`), those tools can pass such content to the agent.
10+
11+
Before this PR, the compiler and `gh aw lint` did not warn on this combination. The existing CTR-008 check covered only `pull_request_target`.
12+
13+
Forces:
14+
15+
- Comment-driven workflows are often intentional. A warning on the trigger alone would flag workflows that limit roles to trusted members or require approved or merged content.
16+
- Integrity filtering protects GitHub tool inputs. It does not control event admission, arbitrary scripts, or execution of PR code, so no single control proves safety.
17+
- Imported configuration can supply the threshold and role policy. Standalone lint does not resolve imports.
18+
- A missing threshold can be filled by defaults or imports, including visibility-dependent defaults. Unknown thresholds, unresolved imports, and unknown repository visibility are therefore not evidence of weak filtering.
19+
20+
The decision prioritizes actionable warnings over trigger-only noise without claiming comprehensive protection. Actor admission does not prove arbitrary PR code or inputs from other tools are safe.
21+
22+
## Decision
23+
24+
Add the default lint rule `dangerous-triggers` as an advisory check, not an authorization mechanism. It covers CTR-039 comment-input risk and the separate CTR-008 target-trigger risk, has Warning severity, and targets both Actions and AW ASTs. The AW comment, review, and slash-command input warning requires both conditions:
25+
26+
1. **Actor admission is broadened.** The effective `on.roles` contains `all`, `read`, or `triage`. The protected defaults (`admin`, `maintainer`, `write`) and explicit trusted-only roles, including `maintain`, do not warn.
27+
2. **Integrity filtering is weak.** GitHub tools are enabled and `tools.github.min-integrity` is `none` or `unapproved`, or `tools.github.lockdown: true` overrides configured guard-policy fields. Explicit thresholds are validated before considering lockdown. Without that override, explicit `approved` or `merged` filtering suppresses the comment-input warning. Disabled GitHub tools suppress it; missing or unknown thresholds, string GitHub shorthand, and bare lockdown without configured guard fields do not establish weak filtering. Lockdown must be disabled before approved/merged filtering takes effect as remediation. `integrity-proxy: false` does not bypass gateway filtering.
28+
29+
Related decisions:
30+
31+
- Compiler lint evaluates effective roles and resolved tools, including imports. Dry-run retains only authored `admin`, `maintainer`, or `maintain` roles, defaulting to `admin`, `maintainer` when none remain; compiler lint uses those restricted roles. Standalone `gh aw lint` uses authored values and does not resolve imports.
32+
- Authored centralized commands remain analyzed alongside generated dispatch graphs without duplicate inline-command findings. AW-backed findings use AW origin paths so authored ignores apply in compilation and companion locks; graph-only findings remain Actions-owned.
33+
- `pull_request_target` keeps its separate CTR-008 target-trigger warning, independent of actor admission and GitHub tool filtering. Only literal AW `on.pull_request_target.acknowledge-risk: true` suppresses that lint warning; it does not suppress comment-input warnings or existing validator checks. Compiler lint avoids duplicating an equivalent CTR-008 validator warning only when that warning was actually emitted, not merely because strict mode is enabled.
34+
- The new rule emits warnings only, including in strict mode. Existing validator behavior is preserved. Generated workflow behavior, permissions, and runtime authorization are unchanged. Specification version 1.0.109 and its single unreleased changelog entry document CTR-039, T-CTR-054, and the review refinements.
35+
36+
## Alternatives Considered
37+
38+
- **Warn on every comment or review trigger.** Rejected. This flags intentional designs that restrict roles to trusted members or require approved filtering, and it adds noise without distinguishing risk.
39+
- **Make the finding a compile error.** Rejected for this change. Blocking the known combination could enforce a stricter organizational policy, but it would break intentional comment-driven designs based on a limited static correlation. Advisory severity preserves compilation behavior while surfacing the review decision.
40+
- **Rely only on an external GitHub Actions event allowlist.** Rejected as the sole control. An organization-level allowlist can exclude unnecessary triggers, but gh-aw cannot query or configure that policy. It complements rather than replaces local diagnostics.
41+
42+
## Consequences
43+
44+
### Positive
45+
46+
- Workflows that combine broadly admitted comment or review events with weak GitHub tool filtering receive a review warning at compile time and in lint.
47+
- Trusted-role workflows and GitHub-disabled workflows avoid the comment-input warning; approved or merged filtering also avoids it unless lockdown overrides policy. These exceptions do not suppress the independent target-trigger warning.
48+
- Compile-time lint uses resolved imports and effective roles, so imported policy is evaluated rather than missed.
49+
50+
### Negative
51+
52+
- The rule adds review noise for workflows that accept untrusted comments on purpose with weak filtering. Warnings do not block merges and do not prove safety.
53+
- Unknown thresholds, unresolved imports in standalone lint, and unknown visibility are not classified as weak policy, so some risky workflows will not be flagged.
54+
- Corpus evidence is partial, so the prevalence of this pattern across public workflows is unknown.
55+
56+
### Neutral
57+
58+
- Authored-policy standalone lint and resolved-policy compiler lint remain distinct paths that require regression coverage.
59+
- Warning deduplication depends on actual validator emission, preserving a target-trigger diagnostic when the validator did not emit an equivalent warning.
60+
61+
## Evidence and Validation Limits
62+
63+
The previously verified public corpus contained 26 authored sources and 26 generated locks across six repositories. Static checks did not execute workflows or resolve imports. Findings fell from eight to zero after actor-role and unknown-policy refinement; this supports reduced false-positive noise in that sample, not universal safety. Discovery was capped and had 30 metadata-access gaps, so the sample is not an exhaustive ranking or prevalence estimate.
64+
65+
Previously reported local build, lint, schema, and impacted-test checks passed. At that earlier revision, the repository gate remained blocked by unrelated workflow-lock drift. That historical result is not the validation status of the current revision; neither it nor the corpus check establishes live/runtime validation.
66+
67+
## References
68+
69+
- [PR #80471](https://github.com/github/gh-aw/pull/80471)
70+
- [Workflow linter reference](../src/content/docs/reference/workflow-linters.md)
71+
- [dangerous-triggers implementation](../../pkg/workflow/lint/dangerous_triggers.go)
72+
- [Alpha-Omega event-policy guidance](https://alpha-omega.dev/blog/de-fanging-dangerous-triggers-in-github-actions-across-an-organization/) (external context, not implementation evidence)

‎docs/src/content/docs/reference/workflow-linters.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Threat IDs refer to the [Compiler Threat Detection Specification](https://github
1717
| `step-reference` | — | AW, Actions | Literal `steps` accesses name a step ID declared in the same job, including bare `if` conditions. Output declarations and ordering are not checked. |
1818
| `template-injection` | `CTR-006` | AW, Actions | Known attacker-controlled expressions are not interpolated into executable `run` or reviewed action code inputs, including values transported through modeled shell step and job outputs. Use environment bindings and runtime data access instead. |
1919
| `workflow-run-scope` | `CTR-021` | AW, Actions | `workflow_run` selects workflows and has a positive branch scope, not only wildcard, negated, or empty filters. |
20+
| `dangerous-triggers` | `CTR-008`, `CTR-039` | AW, Actions | Target-trigger warnings and comment-trigger warnings correlated with actor admission and GitHub integrity filtering, including AW commands. Trusted roles, approved/merged filtering without lockdown override, or explicit GitHub disablement suppress the comment finding; literal AW target-risk acknowledgment suppresses only the target warning. |
2021
| `secret-leak` | `CTR-017` | AW, Actions | Symbolic secrets do not reach modeled disclosure sinks. AW-only checks report missing generated execution coverage. |
2122
| `otlp-secret-leak` | `CTR-017` | AW, Actions | Secret-tainted expressions are not exported through OTLP span or resource attributes. Hard-coded credentials and runtime values are not detected. |
2223
| `permission-scope` | `CTR-001` | AW, Actions | Permissions avoid blanket `write-all`; OIDC does not use invalid `id-token: read`. Scoped writes and `id-token: write` are not violations. |
@@ -77,6 +78,18 @@ Directives work in Actions YAML and AW frontmatter. AW comments are not copied i
7778

7879
Suppression acknowledges a diagnostic; it does not establish safety. These comments do not disable independent compiler validation, strict-mode security controls, runtime protections, or external tools such as actionlint and shellcheck.
7980

81+
### Privileged triggers
82+
83+
`dangerous-triggers` correlates `issue_comment`, `pull_request_review`, and `pull_request_review_comment` (plus AW command shorthands) with actor admission and GitHub integrity filtering. AW comment-trigger warnings require both broadened `on.roles` (`all`, `read`, or `triage`) and weak filtering (`tools.github.min-integrity: none` or `unapproved`, or lockdown overriding guard-policy fields). Omitted roles use the protected `admin`, `maintainer`, and `write` defaults, including for slash commands. These defaults and explicit trusted-only roles suppress this trigger finding even when the workflow intentionally reads untrusted GitHub content.
84+
85+
Explicit `approved` or `merged` filtering without a lockdown override, or `tools.github: false`, also suppresses the comment finding. `lockdown: true` warns only when it overrides configured guard-policy fields (`allowed-repos`, legacy `repos`, `min-integrity`, `blocked-users`, `trusted-users`, or `approval-labels`); disable lockdown before using approved/merged filtering as remediation. Explicit thresholds are validated even with lockdown enabled. Missing thresholds, unresolved imports, string GitHub shorthand, and bare lockdown without configured guard fields are unknown, not evidence of weak filtering: public repositories can apply approved filtering automatically. `integrity-proxy: false` does not disable MCP gateway filtering.
86+
87+
Compilation uses effective roles and resolved tools. Dry-run retains only authored `admin`, `maintainer`, or `maintain` roles, defaulting to `admin`, `maintainer` when none remain; lint evaluates those restricted roles, not authored broadened roles. Standalone lint does not resolve imports or determine repository visibility. Actions YAML without companion AW policy does not inherit gh-aw role defaults, and unknown filtering alone does not produce a comment warning. Authored centralized commands remain analyzed alongside generated `workflow_dispatch` triggers, without duplicating inline command expansions. AW-backed findings use authored AW paths for field-scoped suppression in compilation and companion-lock lint; graph-only findings use Actions paths.
88+
89+
Integrity filtering protects GitHub tool inputs, not event admission, arbitrary scripts, or PR-code execution. It does not suppress independent checkout or template-injection findings. `on.pull_request_target.acknowledge-risk: true` suppresses only the target-trigger warning on AW inputs; standalone Actions YAML has no AW acknowledgment. Compilation deduplicates CTR-008 only when the equivalent validator warning was actually emitted, not merely because strict mode is enabled.
90+
91+
The [Alpha-Omega event-policy guidance](https://alpha-omega.dev/blog/de-fanging-dangerous-triggers-in-github-actions-across-an-organization/) recommends an explicit GitHub Actions event allowlist, excluding `pull_request_target` and `issue_comment` when unnecessary. Evaluate the policy before enforcement. These policies are external to gh-aw: compilation does not query or configure them. A role check, risk acknowledgment, lint suppression, or absence of findings does not prove policy enforcement or that untrusted code is safe to execute with credentials.
92+
8093
### Privileged custom code
8194

8295
`privileged-checkout` and `artifact-execution` warn in strict and non-strict mode, are enabled in the default registry, and are not runtime enforcement. Skipping lint removes their diagnostics; strict `pull_request_target` policies still apply, and trigger-risk acknowledgment does not disable these checks.

0 commit comments

Comments
 (0)