Skip to content

docs: specify multi-repository GitHub token brokering - #79073

Closed
pelikhan wants to merge 8 commits into
mainfrom
pelikhan/token-broker-repositories
Closed

pelikhan wants to merge 8 commits into
mainfrom
pelikhan/token-broker-repositories

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Summary

Extend the token-broker specification so workflows can request one GitHub token for multiple explicitly authorized repositories without granting agents write access.

  • Define the proposed github capability with repository lists and a shared read/write permission map.
  • Restrict agents to read-only credentials and confine writes to independently authorized, trusted safe-output jobs.
  • Specify all-or-nothing authorization, GitHub App installation scope, scope-isolated caching, renewal, invalidation, and conformance scenarios.

This is a specification-only change. The new configuration and exchange contract are explicitly marked as not yet implemented; existing Copilot capabilities remain unchanged.

Validation

  • make agent-report-progress
  • git diff --check

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

github-actions Bot commented Nov 18, 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 18, 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 #79073 · copilot · gpt56 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.7K · ◷

@pelikhan

Copy link
Copy Markdown
Collaborator Author

@copilot rename "invalidation" to "revocation"

@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 54e520e121dc4fb6437aba75c3ec175e89811840 against Token Broker Specification v1.1.0 and the existing safe-output authentication contracts.

Finding

One compatibility gap requires correction: the new broker mutual-exclusion rules explicitly mention handler-level safe-output credentials but do not name or test the existing global safe-outputs.github-token and safe-outputs.github-app settings. Without that coverage, the contract leaves coexistence and precedence for a global safe-output credential undefined. See the inline comment on Section 3.1, line 125.

No specification synchronization was proposed; the required change is to complete the new validation contract and conformance coverage while preserving existing authentication boundaries.

References:

  • docs/src/content/docs/specs/token-broker-specification.md (v1.1.0, Sections 3.1 and 7)
  • specs/security-architecture-spec.md (existing global and per-handler safe-output credentials)
  • docs/src/content/docs/specs/checkout-behavior-specification.md (safe-output authentication precedence)

Generated by PR Specification Reviewer for #79073 · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.7K
Comment /review-specs to run again


The compiler MUST reject `permissions.repos` unless `tools.github.token-broker` is enabled, and `safe-outputs.permissions.repos` unless `safe-outputs.token-broker` is enabled. It MUST also reject any effective repository `write` permission for the agent, empty or malformed broker scopes, and an enabled broker marker combined with `github-token` or `github-app` for the same consumer, including safe-output handler overrides. Safe-output repository permissions MAY be `read` or `write`; write access MUST be limited to the configured safe-output operations. Supplying only `repos` in `safe-outputs.permissions` with `safe-outputs.token-broker` enabled MUST preserve the normal permission inference for those operations, not authorize arbitrary writes. The compiler MUST NOT copy or merge safe-output authority into the agent configuration.

For each consumer, enabled `token-broker`, `github-token`, and `github-app` authentication are mutually exclusive. The compiler MUST refuse any combination of two or more, rather than apply precedence or silently ignore a setting. The compilation error MUST identify the conflicting configuration paths and instruct the author to select one authentication method. An enabled `safe-outputs.token-broker` MUST also conflict with handler-level `github-token` or `github-app` overrides. Selecting broker authentication for both the agent and safe outputs is valid: these are independent consumers, not conflicting authentication sources.

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.

The mutual-exclusion requirement should explicitly cover the existing safe-outputs.github-token and safe-outputs.github-app settings, not only handler-level overrides. The repository's security/checkout contracts define both global and per-handler safe-output credentials, so a workflow could otherwise enable safe-outputs.token-broker alongside a global credential without a specified rejection or precedence rule. Please name those configuration paths and add them to T-TBR-025 (and the related validation requirement) so the new broker cannot coexist with an existing safe-output authentication source.

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-c9fe0eae-d4fc-4d4b-b83a-3f87d480a916","parents":[],"payload":{"id":"ldg-3ea563f6-4900-4ecf-9c74-a583248a3b8a","operation":"append","value":{"finding_count":1,"head_sha":"54e520e121dc4fb6437aba75c3ec175e89811840","outcome":"regression"}},"sha":"sha256:0701b0c99010384fb2e7811d11c77f40422e36c0e4e7964ec2069808042fe8d5","timestamp":"2026-11-18T19:24:56.570Z","type":"ledger_append","version":1}
History

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

Unresolved critical specification gaps can expose broader default credentials, reject valid non-broker workflows, and allow usable credentials to be issued after cleanup completes.

6 open issues
What changed in this PR

Extends gh-aw’s token-broker specification with proposed GitHub authentication across explicitly authorized repositories. This is a specification-only change; the new GitHub capability remains unimplemented.

Changes:

  • Defines consumer-local opt-ins, repository lists, and shared permission maps.
  • Restricts agents to read-only credentials and reserves writes for independently authorized safe-output jobs.
  • Expands exchange, issuance, caching, renewal, invalidation, and conformance requirements.
File Description
docs/​src/​content/​docs/​specs/​token-broker-specification.md Specifies multi-repository GitHub brokering, trust boundaries, credential lifecycle, and validation scenarios.

Review effort: Max (adaptive)

Comment on lines +123 to +125
The compiler MUST reject `permissions.repos` unless `tools.github.token-broker` is enabled, and `safe-outputs.permissions.repos` unless `safe-outputs.token-broker` is enabled. It MUST also reject any effective repository `write` permission for the agent, empty or malformed broker scopes, and an enabled broker marker combined with `github-token` or `github-app` for the same consumer, including safe-output handler overrides. Safe-output repository permissions MAY be `read` or `write`; write access MUST be limited to the configured safe-output operations. Supplying only `repos` in `safe-outputs.permissions` with `safe-outputs.token-broker` enabled MUST preserve the normal permission inference for those operations, not authorize arbitrary writes. The compiler MUST NOT copy or merge safe-output authority into the agent configuration.

For each consumer, enabled `token-broker`, `github-token`, and `github-app` authentication are mutually exclusive. The compiler MUST refuse any combination of two or more, rather than apply precedence or silently ignore a setting. The compilation error MUST identify the conflicting configuration paths and instruct the author to select one authentication method. An enabled `safe-outputs.token-broker` MUST also conflict with handler-level `github-token` or `github-app` overrides. Selecting broker authentication for both the agent and safe outputs is valid: these are independent consumers, not conflicting authentication sources.

### 3.2. Replacement of the built-in Actions token

For an enabled GitHub context, the returned broker token MUST replace the built-in GitHub Actions token (`GITHUB_TOKEN`, also exposed through `github.token` and `secrets.GITHUB_TOKEN`) wherever the compiler/runtime would otherwise supply that token for the context's GitHub operations. It is the context's GitHub credential, not an additional credential used only for cross-repository calls. The compiler/runtime MUST bind GitHub API clients, GitHub MCP authentication, CLI token environments such as `GH_TOKEN` and `GITHUB_TOKEN`, and compiler-managed action token inputs to the broker credential wherever those consumers would otherwise use the built-in token. This binding does not change GitHub's immutable expression-context values; consumers MUST NOT implicitly select those values instead of the broker credential.
```

The broker MUST verify the identity and revoke all credentials it issued to that exact authorized execution context, including credentials for any provider or capability issued in that job. The operation MUST be idempotent and MUST NOT revoke credentials belonging to another job, run, attempt, repository, or tenant. A successful invalidation MUST return HTTP 204 with an empty body and `Cache-Control: no-store`. The client MUST fail the invalidation step on any other status, without exposing response bodies or transport diagnostics. The server MUST reject malformed requests and MUST NOT disclose whether credentials exist for an unauthorized context.
The broker MUST verify the identity and revoke every token it issued to that exact authorized execution context, including all capabilities, providers, repository sets, permission maps, and tokens superseded by renewal. It MUST NOT limit revocation to tokens retained in the client's cache or the latest exchange. Successful invalidation MUST leave no token issued to that job usable. The operation MUST be idempotent and MUST NOT revoke credentials belonging to another job, run, attempt, repository, or tenant. A successful invalidation MUST return HTTP 204 with an empty body and `Cache-Control: no-store` only after revocation is effective. The client MUST fail the invalidation step on any other status, without exposing response bodies or transport diagnostics; the compiler MUST NOT suppress this failure with `continue-on-error`. The server MUST reject malformed requests and MUST NOT disclose whether credentials exist for an unauthorized context.
| `token_type` | Exactly `copilot-request`, `copilot-task`, or `github`, case-sensitive. |
| `provider` | Required only for `copilot-request`. A nonempty inference-provider identifier matching gh-aw's provider IDs (for example, `github`). It MUST NOT be a provider endpoint or URL. |
| `repositories` | Required only for `github`. A nonempty array of at most 500 explicit `owner/repo` strings on the enrolled GitHub deployment, without URLs, wildcards, or duplicates under case-insensitive comparison. |
| `permissions` | Required only for `github`. A nonempty object mapping repository permission names supported by the approved issuer to exactly `read` or `write`. Duplicate keys, unknown names, organization/account permissions, and administrative permissions such as `administration` are forbidden. |

#### 4.5.1. Individual-token invalidation

The endpoint MUST additionally accept a request to invalidate a single broker-issued token. This UTF-8 JSON request MUST contain exactly three unique string members:

The `token` member MUST satisfy the token syntax in Section 4.3. The client MUST acquire a fresh OIDC identity with the configured audience. Possession of the token alone MUST NOT authorize revocation: the broker MUST verify the OIDC identity and bind the token to that exact authorized execution context before revoking it. It MUST NOT revoke tokens from another job, run, attempt, repository, or tenant. A valid identity submitting an unknown or foreign token MUST receive the same sanitized HTTP 403 response, without disclosing token ownership or existence.

Successful revocation MUST return HTTP 204 with an empty body and `Cache-Control: no-store` only after the token is unusable. Repeating the operation for an already revoked or expired token belonging to the same authorized context MUST also return 204. The broker MUST retain sufficient bounded, non-secret issuance evidence to support idempotency until the token's original expiration. Revocation of one token MUST NOT revoke unrelated tokens. The transport, request-size, identity-verification, timeout, failure, and credential-redaction requirements apply equally to this operation.

Copilot AI commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@copilot rename "invalidation" to "revocation"

Updated the draft specification in 28cecf41 to use “revocation” for credentials, with revoke and revoke-token as the operation names.

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.

3 participants