Skip to content

Add token-broker authentication for GitHub tools and safe outputs - #79105

Merged
pelikhan merged 24 commits into
mainfrom
copilot/extend-token-broker-support
Nov 19, 2026
Merged

pelikhan merged 24 commits into
mainfrom
copilot/extend-token-broker-support

Conversation

@pelikhan

@pelikhan pelikhan commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Adds the token broker as an alternative to GitHub App signing keys for GitHub tools and safe outputs, through tools.github.token-broker and safe-outputs.token-broker. Enterprises can issue scoped installation tokens through one broker instead of creating and distributing an App per repository.

  • Configuration: Each section opts in independently. A bare token-broker: means true; explicit true and false still work. The compiler rejects a section's broker combined with its github-app or github-token, and keeps existing defaults, imports, and per-handler overrides.
  • Authentication: Adds the github-app broker capability. Tokens are masked and stay in the job that requested them. Only consuming jobs get id-token: write. There is no fallback to other credentials.
  • Authority: Broker policy chooses the installation, repositories, and permissions from the verified job identity, never from caller-supplied scopes. GitHub tool tokens must be read-only. Safe-output tokens get only the permissions their configured effects need, independent of the agent's permissions.
  • Lifetime: Tokens are job-scoped. Each consuming job invalidates its credentials in an unconditional cleanup step. The spec requires revocation for that job attempt and a refusal to issue new tokens once it has closed. If cleanup can't run, the token's own expiry still applies. Tokens are not renewed automatically.
  • Isolation: GitHub tool authentication requires the AWF sandbox, which keeps OIDC request credentials and the broker URL out of the agent. The broker URL comes only from the GH_AW_TOKEN_BROKER_URL Actions secret.
  • Work queue: Dispatch can't use brokered tokens, because they carry no verified App identity. It requires an explicit dispatch-workflow credential.
  • Threat model: The spec has an experimental threat model, authoritative server validation requirements (SV-01 to SV-37), and a bounded TLA+ model in specs/token-broker/. The model found four gaps, each now closed:
    • Persistent self-hosted runners can carry planted code into a credential job. The broker must deny unenrolled runners (SV-36), and the compiler warns when a broker-enabled job selects a self-hosted runner.
    • A foreign repository calling an approved reusable workflow could receive credentials. The broker must now approve both workflows (SV-16).
    • An exchange racing invalidation could survive it. Invalidation now closes the job before revoking, and recording re-checks closure (SV-28, SV-31).
    • Cleanup may not run if the runner is lost. The broker should revoke on job completion (SV-37).
    • Residual risk: App tokens trigger CI on bot-authored pull requests. Operators must require approval for those workflows.
  • Operator review: Custom steps, jobs, and actions in a brokered job have that job's full credential authority. The docs require operators to review them, pin actions to commit SHAs, and keep untrusted input from selecting code. safe-outputs.jobs do not inherit safe-outputs.token-broker.
tools:
  github:
    token-broker:

safe-outputs:
  token-broker:
  add-comment:

The broker server is deployment-owned and not part of this PR. Before broad write rollout, deployments must show in real runs that tokens are least-privilege, revoked when the job ends, refused once the job is closed, and expire if cleanup can't run.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

@copilot do a security / threat analysis of this feature focused on authorization, scope, incident mitigation

@pelikhan

Copy link
Copy Markdown
Collaborator Author

@copilot mark feature as experimental

Copilot AI commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@copilot do a security / threat analysis of this feature focused on authorization, scope, incident mitigation

Security/threat assessment — authorization, scope, and incident mitigation:

  • Authorization authority: The client sends only token_type and the OIDC JWT; it does not let the caller request an installation, repository scope, or permissions (/home/runner/work/gh-aw/gh-aw/actions/setup/js/token_broker.cjs:126-131). This prevents caller-selected scope escalation, but does not itself authorize a token. The deployment broker must verify issuer/signature/audience/time, bind stable repository IDs and tenant, and enforce workflow revision/ref, event/fork, run/attempt, capability, and resource policy before minting (/home/runner/work/gh-aw/gh-aw/docs/src/content/docs/specs/token-broker-specification.md:201-237). The server and integrated deployment are outside this PR; the spec explicitly records that end-to-end acceptance is incomplete (line 26).

  • Consumer separation is an open authorization condition: Both the GitHub tool and safe-output path request the same github-app capability with the same request shape; the client’s cache key includes GITHUB_JOB, but that value is not sent to the broker. The spec notes that standard OIDC claims may not identify the consuming job and requires trusted job evidence if job-level authorization is needed (lines 217-225). Therefore, do not treat GITHUB_JOB, token_type, or the local cache key as proof of consumer identity. Before enabling both paths, the deployment must demonstrate a trustworthy way to distinguish their authorities and enforce read-only GitHub-tool tokens versus only the approved safe-output effects. If it cannot, deny the exchange rather than issue the union of those permissions.

  • OIDC is job-scoped, not step-scoped: The compiler grants id-token: write to the consuming job (/home/runner/work/gh-aw/gh-aw/pkg/workflow/compiler_main_job.go:68-73; safe outputs at compiler_safe_outputs_job.go:835-837). AWF excludes the OIDC request variables from the sandboxed agent (/home/runner/work/gh-aw/gh-aw/pkg/workflow/awf_env.go:192-198), but safe-outputs.steps also run in the broker-enabled job (compiler_safe_outputs_job.go:470-502). Any action or script in that job is consequently inside the OIDC trust boundary and can request an identity token; pinning alone does not make arbitrary step code trusted. Keep those steps/actions trusted, and make the broker deny untrusted workflow revisions and fork execution by default.

  • Scope and exposure: Installation, target repositories, token permissions, and lifetime are server policy, not scopes validated by this client. The broker must issue least privilege: read-only for GitHub tools and only the permissions/resources required by approved safe-output effects (spec lines 79-82, 225-249). Returned tokens are masked and transferred only within the consumer job; there is no legacy-credential fallback. Static github-app consumers do not renew, so expiry can interrupt long jobs.

  • Incident mitigation: The compiler adds an always() invalidation step (/home/runner/work/gh-aw/gh-aw/pkg/workflow/token_broker.go:151-166). This is useful cleanup, not a hard guarantee: force termination, runner loss, or broker outage can skip/fail it. The actual exposure bound is the broker-enforced credential lifetime; require short bounded lifetimes and tested job-scoped revocation, with an operational kill switch/revocation path and access-controlled audit records (spec lines 182-195, 261-265, 345-351). Protect the configured endpoint and egress as well: the endpoint is resolved from vars before secrets, so a party able to change that variable can redirect the OIDC exchange to another HTTPS service (spec line 351).

No direct client-side scope parameter or fallback bypass was found. The main go/no-go item is proving consumer-level authorization at the broker; the OIDC/job-step boundaries and revocation behavior must also be covered in deployment tests.

Copilot AI commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@copilot mark feature as experimental

The token-broker feature is marked experimental in the shared feature catalog and documentation, and enabling either GitHub API broker option emits the experimental compile warning. I added regression coverage for both options individually and together. Commit: 1cd38686.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

@copilot

  • update token provide to resolve url from a single variable location, secrets... not vars... no chained resolutions

Copilot AI commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@copilot

  • update token provide to resolve url from a single variable location, secrets... not vars... no chained resolutions

Updated all broker consumers and invalidation to use only secrets.GH_AW_TOKEN_BROKER_URL, with regression coverage and migration guidance. Commit: 3e96b715. Focused tests passed; the final gate encountered unrelated existing custom-linter findings.

@pelikhan
pelikhan marked this pull request as ready for review November 18, 2026 21:56
Copilot AI adaptive review requested due to automatic review settings November 18, 2026 21:56
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

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 · ⊞ 7.2K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

🔎 PR Code Quality Reviewer is reviewing code quality for this pull request...

@github-actions

Copy link
Copy Markdown
Contributor

🚀 PR Specification Reviewer has started processing this pull request

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: sonnet55 high · ~13 AIC · ⊞ 8.6K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills...

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

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 #79105 · codex · routed: gpt61 medium · ~8 AIC · ⊞ 185 · ◷

…broker-support

# Conflicts:
#	pkg/cli/org_rollout.go

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

[!WARNING]
Threat detection engine error
...

Merged main and resolved the rollout conflict in e7d40d1ded. Focused and impacted Go tests, 334 impacted JavaScript tests, JavaScript lint, and schema checks passed. Workflow recompilation stalled on an npm metadata request; Go linters were stopped due to resource use, and CodeQL timed out.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@copilot add human friendly documentation page for token-broker with mermaid diagrams explaining the protocol .

Added an experimental token-broker overview with exchange, authority, and cleanup diagrams in db1b1466. Documentation title tests were blocked by npm registry DNS resolution; the final validation gate timed out.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Visual regression check: docs home page

Scope: /gh-aw/ (single page), sandbox-local preview on 127.0.0.1.

Page Viewport Capture Comparison
Home /gh-aw/ Mobile 375×812 captured unavailable
Home /gh-aw/ Tablet 768×1024 captured unavailable
Home /gh-aw/ Desktop 1440×900 captured unavailable

Comparison is unavailable: no baseline was provisioned, so no unchanged or changed result is claimed.

Accessibility inspection (full snapshot read to EOF; no confirmed violations):

  • Structure: one h1, sequential h2/h3, banner, main and contentinfo landmarks, labelled navigation regions, and alt text on images.
  • To verify: the "Show 12 more workflows" disclosure (<summary>) is exposed as a generic node, not a button or disclosure control.
  • Low: "Create a workflow" and "Copy installation prompt" appear twice with identical accessible names.

Cleanup: browser closed; preview server stopped.
Console: 0 errors, 4 warnings (not analysed).
Not verified: a file-type check on the screenshots was denied by workflow tool permissions; the three PNG files are present in the output directory.

Generated by 👁️ Visual Regression Checker for #79105 · copilot · routed: haiku55 xhigh · ~4 AIC · ⌖ ~1 AIC · ⊞ 3.4K · ◷

Copilot AI commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

@copilot fix https://github.com/github/gh-aw/actions/runs/44573980043/job/135736674813?pr=79105

Fixed the failing CJS job in 1c646b80 by adding the newly routed LangGraph worker to the conformance portfolio. The focused and impacted JavaScript tests pass; the final local gate reports unrelated existing custom Go-linter diagnostics in pkg/workflow/compiler_github_mcp_steps.go.

@copilot fix ci failures

Fixed the CJS failure in 1c646b80: the LangGraph worker is now included in the conformance portfolio. Focused and impacted JavaScript tests pass; the final gate is blocked only by existing custom Go-linter diagnostics in pkg/workflow/compiler_github_mcp_steps.go.

@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. Fix failing check conclusion (FAILURE): Check run.
  3. Fix failing check impacted-go-tests (FAILURE): Check run.
  4. Fix failing check Unit tests (D-G) (FAILURE): Check run.

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

Structured data
{
  "completed_task": 0,
  "head": "1c646b8072aacc913372db483657fe0333ee8196",
  "kind": "requested",
  "schema_version": "1",
  "state": "54981f2cbef46336e90bf8521dfa7e3b361b07157626abdf0e188d333f0d49b3",
  "work": [
    "42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac",
    "49c80a00fb3786e9cd4801737bd50a4de83978035bb4a487a6bb6689f2c3cd03",
    "51e2287c3d1ee41b7e13769862add61dcd292a623cf943abc5968c984e246bcf"
  ],
  "workflow": "pr-sous-chef"
}

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

gh-aw-bot and others added 2 commits November 19, 2026 18:03

Copilot AI commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@copilot

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

Merged main in 7df6e6bd and fixed the shared Go test failure in f0a04533; focused experimental-feature tests pass. The conclusion failed because the visual-regression agent reported a denied shell-tool invocation, not a broker failure. Workflow recompilation stalled and the final validation gate timed out; CI was not triggered.

@github-actions

Copy link
Copy Markdown
Contributor

Visual regression check: docs homepage

Page Viewport Capture Comparison
/gh-aw/ Mobile 375×812 captured unavailable
/gh-aw/ Tablet 768×1024 captured unavailable
/gh-aw/ Desktop 1440×900 captured unavailable

Comparison is unavailable because no baseline was provisioned for this run. No page was marked unchanged.

Accessibility inspection

The homepage accessibility snapshot (desktop viewport) was read to end of file. Found: skip link, labelled banner, main navigation, main and contentinfo landmarks, one h1, h2 per region, and exposed tab and tabpanel roles.

Possible issue to verify manually:

  • The "Show 12 more workflows" control in the Ready-made workflows section appears as a generic element with a pointer cursor and no button or link role. It may not be operable by keyboard or exposed to assistive technology.

This is a snapshot review, not an automated audit. Contrast and layout were not measured, and screenshots were not compared against a baseline.

Cleanup

The browser was closed and the preview server was stopped. The untracked-artifact check was denied by workflow tool permissions and is reported separately.

Generated by 👁️ Visual Regression Checker for #79105 · copilot · routed: haiku55 xhigh · ~3 AIC · ⌖ ~1 AIC · ⊞ 3.4K · ◷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants