Skip to content

Lint roles: all workflows with threat detection disabled (CTR-005) - #78403

Merged
pelikhan merged 2 commits into
mainfrom
pelikhan/cuddly-happiness
Nov 16, 2026
Merged

pelikhan merged 2 commits into
mainfrom
pelikhan/cuddly-happiness

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Why

Depi Security's Codex issue-labeler attack (https://depi.security/blog/20261111-backdooring-codex/) started with an untrusted user opening an issue. From there it went prompt injection -> shell access in the agent sandbox -> escape via host /tmp (CoreCLR debug pipes) -> token theft -> Actions cache poisoning. The gh-aw equivalent of allow-users: '*' is on.roles: all. When that is combined with threat-detection: false, there is no detection layer between untrusted input and the agent's outputs. The AWF container sandbox also mounts host /tmp read-write, so on its own it does not contain this class of escape.

What

New built-in AW-AST lint rule untrusted-roles-detection (threat rule CTR-005). It runs during gh aw compile and gh aw lint.

  • Fires when on.roles is all (scalar or list entry), threat detection is disabled, and at least one trigger can be fired by an untrusted actor.
  • Severity: error in strict mode (the default), warning with strict: false.
  • Trusted-only triggers are exempt: push, schedule, workflow_dispatch and merge_group. Unknown keys and command-style triggers count as untrusted, so the rule fails closed.
  • Detection status: the compiled job graph is checked first, so detection disabled via an import is still caught. If that isn't conclusive, the rule falls back to the authored safe-outputs.threat-detection (false, enabled: false, engine: false with no steps).
  • Diagnostic: it asks you to remove threat-detection: false or narrow roles. Unless sandbox.agent.runtime: nvx is already set, it also recommends the NVX microVM sandbox. Using NVX does not exempt the workflow.
  • Opt-out: the existing time-limited threat-detection-suppress mechanism with CTR-005.

Also in this PR:

  • ai-moderator.md: removed threat-detection: false and recompiled. It was the only workflow in the repo the rule flagged.
  • Focused tests, a rule contract entry, and an update to the rule list.
  • Docs: the workflow linters, triggers (danger callout) and sandbox (NVX recommendation) pages, specs/compiler-threat-detection-spec.md, and the lint README.
  • Changeset (minor): this is a behaviour change, because existing strict workflows with this combination will now fail to compile.

Review notes

  • The lint package can't import pkg/workflow (import cycle), so the list of gh-aw on: setting keys is copied from gatewayDispatchOnSettings. Keep the two in sync.
  • Follow-up: ai-moderator.md redirects to githubnext/agentics. The upstream copy needs the same threat-detection: false removal, or gh aw update will bring the setting back and the workflow will fail to compile.

Validation: make agent-report-progress passes. I also checked end to end with a built binary: compile fails in strict mode and warns with strict: false.

New AW-AST rule untrusted-roles-detection (CTR-005) flags workflows whose
on.roles is 'all' with untrusted-actor triggers while threat detection is
disabled. Error in strict mode, warning with strict: false. The diagnostic
recommends the nvx microVM sandbox. Re-enable threat detection in
ai-moderator.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review November 16, 2026 15:16
Copilot AI adaptive review requested due to automatic review settings November 16, 2026 15:16
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by PR Specification Reviewer for #78403 · copilot · gpt56 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

Matt Pocock Skills Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~2 AIC · ⊞ 6.7K · ◷

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.5K · ◷

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

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.

Generated by Ponytail Reviewer for #78403 · codex · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

This comment has been minimized.

@github-actions github-actions Bot left a comment

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.

Overview

Reviewed head 03cef159ecc50b14aebceed5c01fc55739a2bf6a against the compiler threat-detection contract (Version 1.0.102), including the changed CTR-005 mapping and supporting documentation.

Finding

  • Blocking: The PR adds a normative untrusted-roles-detection CTR-005 obligation but does not update the specification version metadata or specs/compiler-threat-detection-changelog.md. Section 10 requires the changelog update whenever Section 2/versioned specification content changes. Please synchronize the version and changelog before merge. An inline comment is attached to the changed contract row.

Coverage

Static review only; no tests or conformance scripts were run per reviewer policy. The captured PR head matched the metadata.

References:

  • specs/compiler-threat-detection-spec.md (CTR-005 mapping)
  • specs/compiler-threat-detection-changelog.md (required companion history)

Generated by PR Specification Reviewer for #78403 · copilot · gpt50 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review-specs to run again

Comment thread specs/compiler-threat-detection-spec.md Resolved
@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate: ADR Required

This PR adds 225 lines in business-logic directories (pkg/, threshold: 100) and no ADR was found in the PR body, on the branch, or in a linked issue.

I pushed a draft ADR to the branch: docs/adr/78403-lint-untrusted-roles-with-threat-detection-disabled.md. It is based on the PR description and diff.

Next step: review the draft, fix any [TODO: verify] items (especially Deciders), and change the status from Draft to Accepted or Proposed before merge.

The draft records the decision to add the untrusted-roles-detection lint rule (CTR-005). It also covers the alternatives (docs-only, an unconditional compiler rejection, and relying on NVX alone) and the main trade-offs. Those trade-offs are the breaking change for strict workflows, the duplicated on: settings list, and the upstream githubnext/agentics follow-up.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: sonnet55 high · ~13 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

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.

Review summary

No actionable issues found in the changed lines. The specialist pass was unavailable because its file-read invocation was denied; I completed the independent review of the diff and relevant lint helpers.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-99d489f9-22c6-4bab-9dbf-82410b61fb4b","parents":[],"payload":{"id":"ldg-617dabde-0211-4489-9b07-9ed5377688f8","operation":"append","value":{"finding_count":1,"head_sha":"03cef159ecc50b14aebceed5c01fc55739a2bf6a","outcome":"regression"}},"sha":"sha256:8ae9f16da377ba9647d4d6fadf4404fb983aabf088641bce5ac73e6757133ee3","timestamp":"2026-11-16T15:25:05.380Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-1064ba51-a994-4017-b4d5-858b1e992a4d","parents":[],"payload":{"id":"ldg-df318283-e323-489b-9ee9-193e5dabc37d","operation":"append","value":{"finding_count":0,"head_sha":"03cef159ecc50b14aebceed5c01fc55739a2bf6a","outcome":"no_findings"}},"sha":"sha256:4de31cf66200a2ee432e5b4a50bd1f8bc10d1c953f5342f7d8990009875516f5","timestamp":"2026-11-16T15:25:57.333Z","type":"ledger_append","version":1}
History

@github-actions github-actions Bot left a comment

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.

Skills-Based Review 🧠

Applied /diagnosing-bugs and /codebase-design. Requesting changes on one behavior gap that contradicts the PR's own opt-out promise.

📋 Key Themes & Highlights

Key Themes

  • Suppression gap (blocking): gh aw lint reports CTR-005 even with a valid, unexpired threat-detection-suppress entry. gh aw compile honors it. The changeset and PR body both advertise the opt-out.
  • Duplicated settings list: untrustedRolesOnSettings is a hand copy of gatewayDispatchOnSettings. It matches today but has no drift guard.
  • Unreachable branch: the list-containing-all check is defensive only. The JSON schema rejects roles: [write, all], so the branch never fires through normal compile.

Positive Highlights

  • ✅ Fail-closed default: unknown trigger keys count as untrusted.
  • ✅ Detection-disabled logic covers compiled jobs, imports, and authored threat-detection.
  • ✅ Lock file for ai-moderator recompiles to an identical result.
  • ✅ Targeted lint and rule-contract tests pass.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~2 AIC · ⊞ 6.7K
Comment /matt to run again

Copilot AI left a comment

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.

🟡 Changes recommended

Critical gaps in imported and conditional threat-detection handling allow untrusted workflows to pass strict compilation and publish without inspection.

4 open issues
What changed in this PR

Adds the untrusted-roles-detection lint rule (CTR-005) to flag workflows that admit untrusted actors through on.roles: all while disabling threat detection.

Changes:

  • Registers the rule with strict-mode errors, non-strict warnings, trusted-trigger exemptions, and NVX sandbox guidance.
  • Adds focused tests, rule contracts, documentation, and a minor changeset.
  • Re-enables threat detection for AI Moderator and regenerates its workflow.
File Description
specs/​compiler-threat-detection-spec.md Maps the new rule to CTR-005 and documents its analysis scope.
pkg/​workflow/​lint/​untrusted_roles_detection.go Implements role, trigger, and detection checks with sandbox guidance.
pkg/​workflow/​lint/​untrusted_roles_detection_test.go Covers policy forms, severity, NVX guidance, and compiled graphs.
pkg/​workflow/​lint/​rule_contract_test.go Adds safe and unsafe rule-contract cases.
pkg/​workflow/​lint/​README.md Lists the new rule constructor.
pkg/​workflow/​lint/​lint.go Registers the rule in the default runner.
pkg/​workflow/​lint/​lint_test.go Updates expected rule registration.
docs/​src/​content/​docs/​reference/​workflow-linters.md Documents rule behavior and limitations.
docs/​src/​content/​docs/​reference/​triggers.md Warns about unrestricted roles with disabled detection.
docs/​src/​content/​docs/​reference/​sandbox.md Recommends NVX for untrusted-trigger workflows.
.github/​workflows/​ai-moderator.md Removes explicit threat-detection disablement.
.github/​workflows/​ai-moderator.lock.yml Regenerates detection, publishing dependencies, and cache handling.
.changeset/​untrusted-roles-threat-detection.md Announces the new lint behavior and remediation options.

Review effort: Max (dynamic)

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (specs/compiler-threat-detection-spec.md:537): address unresolved feedback - Review comment
  3. Review (pkg/workflow/lint/untrusted_roles_detection.go:72): address unresolved feedback - Review comment
  4. Review (pkg/workflow/lint/untrusted_roles_detection.go:19): address unresolved feedback - Review comment
  5. Review (pkg/workflow/lint/untrusted_roles_detection.go:90): address unresolved feedback - Review comment
  6. Review (pkg/workflow/lint/untrusted_roles_detection.go:94): address unresolved feedback - Review comment
  7. Review (pkg/workflow/lint/untrusted_roles_detection.go:93): address unresolved feedback - Review comment
  8. Review (pkg/workflow/lint/untrusted_roles_detection.go:68): address unresolved feedback - Review comment

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "1379295142239290e005b1dcc9c21d4ffb0ca58e",
  "kind": "requested",
  "schema_version": "1",
  "state": "e02e375ae65cbec69f0f8bb7b722a95bcc3976a0af139af5a32ac673ad016fa3",
  "work": [
    "0204c31f9b14a76a05c2d555d79a64544ead6ca78108324188f0b1a600740744",
    "07cffd2bfdd860840c68d82cc2c142ea599edfb531418b0905f0a918f6db913c",
    "4ecf7a9401db0b7219a37acdfe95aabfcaa9f55678bb13732956062fca169da8",
    "55a4115ba5acc5c2103c013a87f3ef7b51b68c2842cd148a27228a851e08bd7e",
    "9f594ae95d5adfa764c160240a07277afde5f4dd6cc43fe5e10b543a63714758",
    "ac55da1d1b84cdc54175b4648fd741fc3c41dc836f66093c6779ed55ad724697",
    "ef690ccd87329c8747e249053474a076758a6988c54d4fecb3f5e310c05f8740"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 7K · ◷
Comment /souschef to run again

@pelikhan
pelikhan merged commit 5f2275c into main Nov 16, 2026
52 of 53 checks passed
@pelikhan
pelikhan deleted the pelikhan/cuddly-happiness branch November 16, 2026 16:25
Copilot stopped work on behalf of gh-aw-bot due to an error November 16, 2026 16:25
Copilot AI requested a review from gh-aw-bot November 16, 2026 16:25

Copy link
Copy Markdown
Collaborator Author

Batch update in f0dbc17 addressing the conversation comments:

  • Design Decision Gate (6920675837): Accepted. Reviewed the draft ADR against the implementation, corrected it to reflect the final behavior (resolved detection policy, samples exemption, lint suppression support, drift test), filled in Deciders, and set the status to Accepted.
  • gh-aw-bot prep (6921639852): Done. Merged latest main (no conflicts, recompiled) and addressed all seven linked review threads; each has its own reply.
  • Reviewer status comments (6920511270, 6920511896, 6920514042, 6920516519, 6920517329, 6920527636) and comment-memory ledgers (6920698236, 6920720162): No action needed; these are run summaries and state records, and their concrete findings were handled in the review threads.

Validation: make agent-report-progress passes.

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.3.1

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.

4 participants