The broker portal team gives a coding agent its first real task. The portal shows a raw error page when the quote API answers 404 for another tenant's quote (the correct refusal from case UW-A02), and brokers find it alarming. The task: show a plain "quote not found" message instead, with a test. A small change in the repository example-org/uw-portal.
To get the agent working quickly, a developer gives it what was at hand: their own classic personal access token, so the agent can push a branch and open a pull request, and the repository's existing CI secrets, which include a long-lived cloud access key that the deploy job uses. The agent opens a good pull request within the hour.
Now look at what else that setup allowed, as a labelled mistake. The developer's classic token, per GitHub's documentation, grants access to all repositories in the organizations the developer can reach, including the underwriter cockpit and the authorization policy repository. The developer is a repository administrator, so the token could merge its own pull request past review. And the cloud key in CI secrets is readable by any workflow that can reach those secrets: a test the agent writes can print it. One prompt injected into an issue the agent reads (the shape of series case UW-005) could ask for any of it.
None of that power was needed to fix an error page. The question of this page: for a coding agent, which identity proposes, which identity reviews and merges, which identity deploys, and how do you keep each one narrow?
A coding agent is a principal that writes code#
A coding agent is a program that reads a repository, edits files, runs commands in a sandbox and opens pull requests, driven by a model. To every system it touches it is a principal like any other: it needs a credential, and that credential carries authority. A tiny example: when the agent pushes the branch agent/fix-404-page, GitHub records which identity pushed it and checks that identity's permissions on example-org/uw-portal.
The rule this page builds on is the series refrain in a new place: the model suggests an action; deterministic code decides whether it may run. Here the deterministic code is GitHub's permission checks, branch rules, environment protection and the cloud's trust policy. None of them reads the model's reasoning; all of them read the credential.
Before AI. Build servers taught this a decade ago. A Jenkins agent with a shared admin password, a deploy key with write access to every repository, cloud keys pasted into job configuration: each was convenient, and each became the path an attacker used. The fixes then were scoped service accounts, separate deploy credentials, and approvals before production. A coding agent is a build server that also writes the code it builds, so the same fixes matter more.
Plain English. The agent may write a proposal. A person with merge rights decides whether it goes in. A separate, narrow identity deploys what was merged. The agent never holds the keys to production.
The smallest primitive: three steps, three identities#
| Step | Who acts | Credential | What it may do | What it must not be able to do |
|---|---|---|---|---|
| Propose | The coding agent | Installation token of a GitHub App installed on one repository | Push branches, open pull requests | Merge, change branch rules, read other repositories |
| Review and merge | A person with merge rights | Their own account | Approve and merge into the protected branch | Approve their own change, where rules require another reviewer |
| Deploy | The deploy job in CI | A short-lived cloud credential from OIDC federation | Deploy the merged commit to one environment | Run for an unmerged branch or a pull request |
The table is the design in one view. Each row names who acts and the credential that proves it, and the last column is what the controls below exist to guarantee. The grid adds the fourth identity every repository has, the test job that runs on each push.
Diagram: Who may do what · the agent, the reviewer, the test job, the deploy job
Each row is one identity in the portal fix. Read across: what it holds, what it may do, and what the controls make impossible for it. The agent's row ends at a proposal. Only the reviewer's row includes merge, and only the deploy job's row includes a cloud role, which no other row can assume because the trust condition names the production environment.
- Coding agent
- 1-hour token, one repository: Installation token minted per task, narrowed to uw-portal.
- push a branch, open a PR: Propose a change with tests and evidence.
- merge, read other repos, touch prod: Not on any bypass list; installed on one repository; no production credential in its sandbox.
- Reviewer
- own account: The reviewer's own identity, with merge rights on main.
- approve and merge: Approve someone else's change and merge it when checks pass.
- approve own change: The ruleset requires approval from someone other than the author.
- Test job
- read-only GITHUB_TOKEN: Per-job permissions contents: read; expires with the job.
- build and test: Check out code and run tests with synthetic data.
- read env secrets, assume deploy role: Does not reference the production environment; its sub does not match the trust condition.
- Deploy job
- OIDC token, then a role: id-token: write lets it request the token; the cloud exchanges it for a short-lived role.
- deploy the merged commit: Deploy the attested artifact built from main after a reviewer approves the environment.
- write the quote database: The role's permissions policy allows deployment only, not data writes.
Propose: a repo-scoped GitHub App, not a personal token#
A GitHub App is an integration registered with GitHub that is installed on chosen repositories and acts with its own identity and fine-grained permissions. A personal access token (PAT) is a token a person creates that acts as that person. The difference decides whose authority the agent carries.
Product (GitHub Apps, as documented on 2026-11-18): apps "use fine-grained permissions"; the installer "can decide what repositories the app can access"; "GitHub Apps use short lived tokens", "can act independently of a user", and "remain installed even when the person who initially installed the app leaves the organization." An installation access token "will expire after 1 hour", and when minting it the caller can narrow it with repositories or repository_ids and permissions; if omitted, the token gets all repositories and all permissions granted to the installation.
Product (personal access tokens, as documented on 2026-11-18): GitHub "currently supports two types", and "recommends that you use fine-grained personal access tokens instead of personal access tokens (classic)"; a classic token "will grant access to all repositories within the organizations that you have access to." Fine-grained PATs are limited to resources owned by a single user or organization. If no expiration is chosen the default is 30 days, and infinite lifetimes "are allowed but may be blocked by a maximum lifetime policy." The same page gives the direction plainly: "To access resources on behalf of an organization, or for long-lived integrations, you should use a GitHub App."
So the agent's identity is an app installed on example-org/uw-portal alone, with permission to write contents and pull requests and nothing else. The agent's runtime mints an installation token for each task, narrowed to that one repository. The request shape, from the documentation (documented shape; not run here):
POST /app/installations/INSTALLATION_ID/access_tokens HTTP/1.1
Host: api.github.com
Authorization: Bearer <JWT signed with the app's private key>
content-type: application/json
{"repositories": ["uw-portal"]}
The app's private key that signs that JWT is the credential to protect: it lives with the agent's runtime in a secrets manager, never in the repository or in the sandbox where the model's commands run.
Review and merge: authority the agent does not have#
Branch protection is the set of repository rules that decide who may push to or merge into a branch and what must happen first (reviews, passing checks, signed commits). GitHub now expresses these as rulesets as well as classic branch protection. Product (GitHub rulesets, as documented on 2026-11-18): a ruleset is "a named list of rules that applies to a repository or to multiple repositories in an organization"; rulesets and branch protection "work alongside each other, and all applicable rules are enforced", and where they differ "the most restrictive version of the rule applies". The bypass list can include "users with a certain role, such as repository administrator, or it can be specific teams or GitHub Apps."
That last sentence is where a coding-agent setup goes wrong. The agent's app must not be on any bypass list for the protected branch, and nor should a broad role the agent's identity might inherit. The rule set for main requires a pull request, at least one approval from someone other than the author, and passing checks. The agent proposes; a person with merge rights reviews the diff and the evidence and merges.
One default deserves a check of its own. Product (GitHub Actions settings, as documented on 2026-11-18): for repositories in personal accounts, "workflows are not allowed to create or approve pull requests" by default; organization repositories inherit the organization's setting. If workflows may approve pull requests, an agent that runs inside a workflow can approve its own proposal, and review authority has quietly merged into write access.
In our insurance example. The same separation protects the authorization policy. The difference betweenauthz-2026.10.3andauthz-2026.11.1is one rule: the assignment check ondecision.record. A coding agent could propose that change, or its reverse. Whoever merges it decides which underwriters may record decisions, so the policy repository's ruleset names its own reviewers, and the agent's app is never among them (Policy as code).
The token every workflow already has#
Every GitHub Actions job receives a token without asking. Product (GITHUB_TOKEN, as documented on 2026-11-18): it "is a GitHub App installation access token"; its "permissions are limited to the repository that contains your workflow"; it expires when the job finishes or after its maximum lifetime (at most 6 hours on GitHub-hosted runners). The default permissions depend on settings: for personal-account repositories the restricted default gives read access to contents and packages only, organization repositories inherit the organization setting, and the permissive setting gives read and write for all permissions. GitHub's secure-use guidance says to "set the default permission for the GITHUB_TOKEN to read access only for repository contents".
A workflow narrows it further with a permissions block. Product (workflow syntax): values are read, write or none, and "If you specify the access for any of these permissions, all of those that are not specified are set to none." A job that only runs tests gets contents: read and nothing else.
Secrets in runners, and environments with reviewers#
A runner secret is a credential stored in GitHub for workflows to use (repository, organization or environment secrets). The documentation is blunt about who can read them. Product (secure use, as documented on 2026-11-18): "Any user with write access to your repository has read access to all secrets configured in your repository." A coding agent with write access is such a user, through the workflows it can change.
Environments fix this for the secrets that matter. Product (environments, as documented on 2026-11-18): environment secrets are only available to jobs that reference the environment, and with required reviewers "a job cannot access environment secrets until one of the required reviewers approves it"; up to six users or teams can be listed, there is an option to stop the person who triggered a deployment from approving it, and deployment branches can be limited to protected branches. "Allow administrators to bypass configured protection rules" is on by default and can be turned off.
The design: no cloud credential exists as a repository secret at all. The deploy job references the production environment, which allows only the protected main branch, requires a reviewer, and gets its cloud access through OIDC, so even the environment holds no long-lived key.
The sandbox and the ephemeral build identity#
The agent's commands run in an agent sandbox: an isolated environment (a container or virtual machine) where the agent can edit files and run tests, with only the network access and credentials the task needs. For the portal fix, that is the repository checkout, the test database seeded with synthetic data, and the package registry. It is not the production database. A coding agent's normal sandbox has no production database credential, no route to production networks, and no cloud role that can write data. If the task needs production data to reproduce a bug, a person obtains a sanitized extract through a separate, audited path (Privileged access).
An ephemeral build identity is the CI counterpart: an identity that exists for one job and expires with it, instead of a standing service account. GITHUB_TOKEN is one; the cloud credential the deploy job receives through OIDC is another. Neither can be copied into tomorrow's run, because neither exists tomorrow.
CI to the cloud: OIDC instead of a stored key#
The deploy job still needs to reach the cloud. Instead of a stored key, it asks GitHub for a signed identity token describing the job, and the cloud exchanges that token for short-lived credentials if the job matches a trust condition the cloud account defines. Product (GitHub Actions OIDC, as documented on 2026-11-18): the issuer is https://token.actions.githubusercontent.com; the job must grant id-token: write, which "only enables fetching and setting the OIDC token" and "does not grant write access to other resources"; the default aud is the URL of the repository owner unless a custom audience is requested; the cloud trust "must define at least one condition", or untrusted repositories could obtain access.
The sub claim is what the trust condition usually matches. Its default formats include repo:ORG-NAME/REPO-NAME:environment:ENVIRONMENT-NAME for a job that references an environment, repo:ORG-NAME/REPO-NAME:pull_request, and repo:ORG-NAME/REPO-NAME:ref:refs/heads/BRANCH-NAME. For repositories created after 15 July 2026, GitHub uses "an immutable default subject format that includes both the owner ID and repository ID", documented as repo:OWNER@OWNER-ID/REPO@REPO-ID:ref:refs/heads/BRANCH; older repositories can opt in, and GitHub Enterprise Server is not included. The documentation read here shows the immutable form only for the branch case; check the current reference before writing a condition for an environment on such a repository.
The smallest demonstration of why the condition matters is a matcher. The code below is a standalone teaching script, not part of examples/uw-auth/ and not the cloud's evaluator (fnmatchcase approximates a wildcard string match). It shows three jobs in the same repository, each with its own token, against a repo-wide wildcard condition and a condition that names the production environment. A successful run proves only the matching logic.
from fnmatch import fnmatchcase
ISSUER = "https://token.actions.githubusercontent.com"
def trust_allows(claims: dict, condition: dict) -> tuple[bool, str]:
"""The cloud side's question: does this CI token match the role's trust condition?"""
if claims.get("iss") != ISSUER:
return False, "issuer"
if claims.get("aud") != condition["aud"]:
return False, "audience"
if not fnmatchcase(claims.get("sub", ""), condition["sub"]):
return False, "subject"
return True, "match"
# Three jobs in the same repository, each with its own token (claims shortened).
deploy = {"iss": ISSUER, "aud": "sts.amazonaws.com", "sub": "repo:example-org/uw-portal:environment:production"}
pr_run = {"iss": ISSUER, "aud": "sts.amazonaws.com", "sub": "repo:example-org/uw-portal:pull_request"}
agent_branch = {"iss": ISSUER, "aud": "sts.amazonaws.com", "sub": "repo:example-org/uw-portal:ref:refs/heads/agent/fix-123"}
wide = {"aud": "sts.amazonaws.com", "sub": "repo:example-org/uw-portal:*"}
narrow = {"aud": "sts.amazonaws.com", "sub": "repo:example-org/uw-portal:environment:production"}
for name, cond in (("repo-wide wildcard", wide), ("production environment only", narrow)):
for job, claims in (("deploy job", deploy), ("pull request run", pr_run), ("agent branch push", agent_branch)):
ok, why = trust_allows(claims, cond)
print(f"{name:28} {job:18} {'ALLOW' if ok else 'deny '} ({why})")
repo-wide wildcard deploy job ALLOW (match)
repo-wide wildcard pull request run ALLOW (match)
repo-wide wildcard agent branch push ALLOW (match)
production environment only deploy job ALLOW (match)
production environment only pull request run deny (subject)
production environment only agent branch push deny (subject)
With the wildcard, a workflow running on the agent's branch gets the same cloud role as the reviewed deploy. With the environment condition, only a job that references production matches, and that environment admits only main after a reviewer approves. One of GitHub's AWS trust policy examples uses a repository-wide wildcard on sub (the first one pins a single branch); the same page adds that "If you use a workflow with an environment, the sub field must reference the environment name". Naming the environment is this site's recommendation for any role that can change production.
Here is the documented shape of the two halves, written from GitHub's and AWS's documentation read today (documented shape; not run here). The workflow:
name: deploy-portal
on:
push:
branches: [main]
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
environment: production
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@vN # tag; the lockfile pins the commit SHA
- uses: aws-actions/configure-aws-credentials@vN # same
with:
role-to-assume: arn:aws:iam::ACCOUNT_ID:role/uw-portal-deploy
aws-region: REGION
And the trust policy on the cloud role, which is where the decision is enforced:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {"Federated": "arn:aws:iam::ACCOUNT_ID:oidc-provider/token.actions.githubusercontent.com"},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"token.actions.githubusercontent.com:aud": "sts.amazonaws.com",
"token.actions.githubusercontent.com:sub": "repo:example-org/uw-portal:environment:production"
}
}
}
]
}
ACCOUNT_ID, REGION and vN are placeholders. The role's permissions policy (what it may do once assumed) is a separate document and should allow deployment of the portal only, never writes to the quote database. Product (AWS STS, as documented on 2026-11-18): a role has "a role trust policy that specifies who can assume the role, and a permissions policy that specifies what can be done with the role." Google Cloud and Azure express the same trust with Workload Identity Federation attribute conditions and federated identity credentials; Cloud IAM owns those.
Diagram: Propose, merge, deploy · three identities for the portal fix
Read the lanes top to bottom. The coding agent works in a sandbox with synthetic data and proposes through a GitHub App installed on one repository. A person with merge rights reviews and merges under a ruleset the app cannot bypass. Only then does the deploy job, referencing the production environment, ask GitHub for an OIDC token, wait for a reviewer, and exchange the token for a short-lived cloud role whose trust condition names that environment. No lane hands its credential to another, and no arrow runs from the sandbox to the production database.
- Propose: the coding agent
- agent sandbox: Isolated environment where the agent edits and tests, with no production credential and no route to production.
- GitHub App token for one repository: The agent's runtime mints an installation token narrowed to uw-portal; the app's private key stays outside the sandbox.
- Review and merge: a person
- ruleset on main: Requires a pull request, an approval from someone other than the author, and passing checks; the agent's app cannot bypass it.
- reviewer merges: A person with merge rights reads the diff and the evidence and decides. The agent proposes; a person decides.
- Deploy: an ephemeral identity
- deploy job env: production: Runs only on main; references the production environment, which requires a reviewer before secrets or tokens are released.
- cloud trust policy sub = environment: The cloud checks iss, aud and sub against the role's condition and returns short-lived credentials.
- deploy attested artifact: The artifact carries a signed attestation of how it was built; the deploy step verifies it first.
The diagram follows the portal fix from the agent's sandbox to production. Three credentials appear, and none of them crosses into another lane: the app's installation token proposes, a person's account merges, and the deploy job's OIDC token, matched by the cloud's trust policy, deploys. The one arrow the picture deliberately lacks runs from the sandbox to the production database.
Supply chain: what you run, and proof of what you built#
A coding agent adds dependencies and edits workflows, so two supply-chain controls belong here.
Lock workflow dependencies. Product (GitHub Actions, as documented on 2026-11-18): GitHub's secure-use page now says "The best measure is to lock your workflow dependencies with a lockfile", which "supersedes SHA pinning for repositories that adopt it". The lockfile at .github/workflows/actions.lock, generated with the gh actions-lock extension, pins a commit SHA to every action including transitive dependencies; it does not pin reusable workflow calls, inputs, secrets or the runner image, and lockfiles "don't determine whether a dependency is safe". Workflow lockfiles became generally available on 28 October 2026. SHA pinning remains the fallback for repositories that cannot adopt one. A change by the agent to actions.lock deserves the same review as a change to code.
Attest what you built. Supply-chain provenance is signed evidence of how an artifact was built: from which source, by which workflow, on which platform. Product (GitHub artifact attestations, as documented on 2026-11-18): they "enable you to create unfalsifiable provenance and integrity guarantees for the software you build", signed through Sigstore; "Artifact attestations by itself provides SLSA v1.0 Build Level 2", and reusable workflows can provide the isolation "to meet SLSA v1.0 Build Level 3"; verify with gh attestation verify. Standard (SLSA, read 2026-11-18): the current specification is "Version 1.2", status Approved; GitHub's documentation still cites v1.0 levels. Both statements are true on the date read; when a policy says "SLSA Build L2", say which version it means.
Here is the whole set of controls with what each stops and what it leaves:
| Control | Stops | Does not stop |
|---|---|---|
| Repo-scoped GitHub App | Agent reaching other repositories; authority tied to a person | Bad changes inside the one repository |
| Ruleset without the agent on the bypass list | Agent merging its own work | A reviewer approving a bad diff |
| Read-only default GITHUB_TOKEN and per-job permissions | Workflows writing more than they need | A job granted too much on purpose |
| Environment with required reviewers | Unreviewed jobs reading production secrets | Secrets stored at repository level |
| OIDC trust on the environment subject | Agent branches and pull requests assuming the deploy role | Over-broad permissions on the role itself |
| Sandbox without production credentials | Agent writing production data | Data the sandbox already holds |
| Workflow lockfile | A moved tag silently changing what runs | A pinned dependency that was malicious from the start |
| Artifact attestations | Deploying an artifact of unknown origin | A correctly built artifact with a bug |
Every right-hand cell is a residual risk with an owner: the reviewer, the role designer, the dependency review.
What this is not. How to ship changes with coding agents (hooks, review lanes, CI capacity, evidence on pull requests) is the subject of Diff to Deploy, in particular its review and CI/CD agents pages. This page owns only who holds which authority. The model credential of the agent's runtime is on Model providers.
Failure mode: the classic token and the cloud key#
Return to the first setup and follow it to the end, as a labelled mistake. A test the agent wrote prints environment variables while debugging a flaky run; the CI log now holds the cloud key, readable by everyone with access to the logs. Separately, an issue on the repository contains text asking the agent to "also update the cockpit's decision handler", and the developer's classic token can push there. Nothing here required an attacker who broke a control; the controls were never in the path.
The corrected state, all of it from this page: the agent acts as a GitHub App installed on example-org/uw-portal only, with a one-hour token; main is protected by a ruleset the app cannot bypass; workflows default to read-only and request id-token: write only in the deploy job; there is no stored cloud key, only a role whose trust condition names the production environment, which requires a reviewer; the sandbox holds synthetic data and no production credential; and the artifact carries an attestation verified before deploy.
Architecture choice#
| Situation | Simplest credible option | Grow when | Alternatives |
|---|---|---|---|
| A developer pairs with an agent locally | Agent uses the developer's session in a local sandbox; the developer pushes and opens the pull request | The agent runs unattended or in CI | A fine-grained PAT for one repository with a short expiry |
| Agent runs unattended on one repository | GitHub App installed on that repository, minimal permissions, one-hour tokens | Several repositories or teams | One app per repository class |
| Agent in CI that deploys | Separate deploy job, environment with reviewers, OIDC role per environment | Several clouds or accounts | A deployment service that pulls attested artifacts |
| Agent fixing production incidents | Read-only diagnostic access; changes go through the normal pull request path | Never let the routine agent hold write access to production | A person with JIT elevation runs the fix |
This site's recommendation: keep three identities for three authorities (propose, merge, deploy), make the first one a repo-scoped app, keep people as the second, make the third ephemeral and federated, and give the routine coding agent no production power at all.
Security notes#
Security note. Avoid pull_request_target unless you need it. GitHub's secure-use page calls it privileged; such a workflow must never check out and run untrusted code from a fork.
Security note. Turn off "Allow administrators to bypass configured protection rules" on production environments, and keep the agent's app off every ruleset bypass list.
Production pitfall. A cloud trust condition on a multi-tenant issuer must name your organization. Google Cloud's documentation warns that GitHub uses "a single issuer URL across all organizations"; a condition that checks only the issuer trusts every repository on GitHub.
Monday checklist#
- List every credential your coding agents use. Replace classic and broad PATs with a GitHub App installed on the repositories they need.
- Read the bypass list of every ruleset on protected branches; remove agent apps and broad roles.
- Set the default
GITHUB_TOKENpermission to read-only and add per-jobpermissionsblocks. - Move production secrets into environments with required reviewers, and replace stored cloud keys with OIDC roles whose
subnames the environment. - Check the agent sandbox for any production credential or route; remove it.
- Adopt the workflow lockfile and verify attestations before deploy.
Exercises#
- The agent's app is on the ruleset bypass list "so it can fix formatting on main". What do you change?
AnswerRemove it; formatting goes through a pull request
Bypass gives the agent merge authority on every change, not only formatting. Remove the app from the list and let a formatting job open a pull request that a person merges, or run the formatter as a required check.
- A cloud role's trust condition is
repo:example-org/uw-portal:*. Which jobs can assume it?
AnswerEvery workflow run in the repository
Branch pushes, pull request runs and environment jobs all match, as the matcher run shows. Name the environment for any role that can change production.
- The agent needs to reproduce a bug that only appears with real quote data. What path do you give it?
AnswerNone to production; a person supplies sanitized data
A person with time-bound elevation produces a sanitized extract through an audited path; the agent's sandbox never receives a production database credential.
Advanced perspective#
GitHub App or fine-grained PATWhose authority, how long, and what happens at a leaver
A fine-grained PAT can be narrowed to one repository and given an expiry, and for a developer pairing with an agent on a laptop that is often enough. Its limits show up when the agent runs without the developer. The token acts as the developer, so audit records name the developer for the agent's actions; it lives until its expiry (30 days by default), not an hour; and when the developer leaves, the integration breaks or, worse, keeps working until someone notices. GitHub's documentation also notes that tokens needing organization approval stay pending until an admin reviews them, and that unused tokens are removed after a year.
A GitHub App separates the integration from any person, survives the installer leaving, and issues tokens that expire after an hour and can be narrowed per task. The cost is a private key to protect and an installation to govern. Treat that private key like the provider credential of an LLM gateway: one holder, a secrets manager, rotation, and audit of every token minted.
OIDC trust conditions that age wellRenames, numeric ids, environments and custom claims
A sub condition written with names breaks or, worse, transfers when names change: a repository renamed and a new one created with the old name could match an old condition. GitHub's immutable subject format, default for repositories created after 15 July 2026, puts the owner and repository ids into the sub (@ cannot appear in GitHub names, so the format is unambiguous). Google Cloud's documentation gives the same advice from the other side: prefer the numeric *_id claims, "which are unique and can't be reused", and map at least google.subject to assertion.sub.
Beyond sub, the token carries claims such as repository_owner_id, job_workflow_ref, environment, ref and runner_environment, and organization admins can add custom repository property claims prefixed repo_property_. A condition on job_workflow_ref can require that deployment runs through one reviewed reusable workflow, which also supports SLSA Build Level 3 isolation. Customizing the sub (PUT /repos/{owner}/{repo}/actions/oidc/customization/sub) changes every token; GitHub advises creating the matching cloud condition first.
When the agent's actions start other workflowsGITHUB_TOKEN events, approvals and recursive runs
Events caused by GITHUB_TOKEN generally do not start new workflow runs, which stops a workflow from triggering itself in a loop. The documented exceptions are workflow_dispatch and repository_dispatch, and pull requests opened, synchronized or reopened by it, which start in an approval-required state. An agent that pushes with its GitHub App token instead of GITHUB_TOKEN does start workflows, which is usually what you want (its pull request should be tested), but it means the agent can cause any workflow its pushes trigger to run.
That is why the deploy job's trigger, environment and trust condition matter together. A push to the agent's branch may run tests; it must not reach a job that references production, and if it did, the environment's branch rule and required reviewer would stop it before any secret or cloud credential was released.
Verifying provenance at deploy timeAn attestation nobody checks is a receipt in a drawer
Producing attestations is one step; using them is another. The deploy side (a deployment service, an admission controller, a release job) should verify before it runs anything: that the artifact's attestation was signed for this repository, by the expected workflow, from a commit on the protected branch. GitHub documents gh attestation verify PATH/TO/ARTIFACT -R ORGANIZATION_NAME/REPOSITORY_NAME for this.
Provenance answers "where did this come from?", not "is it correct?". Combined with the merge rules above it gives a chain: a person merged this commit, this workflow built it, this artifact is what was built. The coding agent appears in that chain only as the author of a proposal, which is the authority it should have. The audit records that make the chain reconstructable later belong to the next page.
In one breath#
A coding agent is a principal that writes code, and the safe design gives it exactly one authority: to propose. A repo-scoped GitHub App with one-hour tokens proposes; a person with merge rights, under rules the app cannot bypass, decides; and a separate deploy job with an ephemeral OIDC credential, matched by a trust condition that names the production environment, deploys an attested artifact. The routine agent's sandbox holds no production credential, so no prompt, however clever, can turn a proposal into a production change.
Every identity on this page now leaves a trace: the app that pushed, the person who merged, the job that deployed, the role it assumed. The same is true of the underwriting agent's run, the underwriter's decision and every denial along the way. Whether those traces can be correlated, trusted and read later without leaking a token is the subject of Audit.