Contents: Write
Why Tier 2
Pushes commits, creates, moves and deletes branches, tags and releases, merges pull requests, and sends repository_dispatch events. Cannot change files under .github/workflows without Workflows: write. On a repository other projects consume, moving a tag changes what they run, unless the tag belongs to an immutable release: its tag and assets are locked, though the release can still be deleted.
Can reach T1 when a workflow that uses secrets runs code it can change, such as build scripts, tests, package manifests or a local action outside .github/workflows, on a push to a branch it creates, or passes a repository_dispatch payload it sends to a shell.
Inferred from: GitHub Docs: secure use, GitHub Docs: events that trigger workflows, GitHub Docs: reposTested 2026-10-31 in a test organization: A GitHub App with only Contents (write) pushed a new branch that changed a local action under .github/actions. The push workflow ran as the App and the changed action printed the length of a repository secret. The same App's push of a change under .github/workflows was refused for lack of Workflows (write).
- Target
- Repository
- Plane
- DataCode: Repository contents, branches, tags, pull requests, checks and commit signing keys.
- Granted by
- Fine-grained PAT, GitHub App, GITHUB_TOKEN
- Available on
- Every setup
- In a workflow
permissions: contents: writeWorkflow scopes by tier
What it unlocks
46 REST endpoints need this permission, from GitHub's docs data. Some also need another permission, and a few work with only one kind of token.
- POST /repos/{owner}/{repo}/branches/{branch}/rename
- POST /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/autofix/commits
- DELETE /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}
- POST /repos/{owner}/{repo}/code-scanning/codeql/variant-analyses
- PATCH /repos/{owner}/{repo}/comments/{comment_id}
- DELETE /repos/{owner}/{repo}/comments/{comment_id}
- POST /repos/{owner}/{repo}/comments/{comment_id}/reactions
- DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}
- PUT /repos/{owner}/{repo}/contents/{path}also needs Workflows: Write
- PUT /repos/{owner}/{repo}/contents/{path}also needs Workflows: Write
- DELETE /repos/{owner}/{repo}/contents/{path}also needs Workflows: Write
- DELETE /repos/{owner}/{repo}/contents/{path}also needs Workflows: Write
- POST /repos/{owner}/{repo}/dependency-graph/snapshots
- POST /repos/{owner}/{repo}/dispatches
- POST /repos/{owner}/{repo}/git/blobs
- POST /repos/{owner}/{repo}/git/commits
- POST /repos/{owner}/{repo}/git/refsalso needs Workflows: Write
- POST /repos/{owner}/{repo}/git/refsalso needs Workflows: Write
- PATCH /repos/{owner}/{repo}/git/refs/{ref}also needs Workflows: Write
- PATCH /repos/{owner}/{repo}/git/refs/{ref}also needs Workflows: Write
- DELETE /repos/{owner}/{repo}/git/refs/{ref}
- POST /repos/{owner}/{repo}/git/tags
- POST /repos/{owner}/{repo}/git/trees
- PUT /repos/{owner}/{repo}/importuser access tokens only
- PATCH /repos/{owner}/{repo}/importuser access tokens only
- DELETE /repos/{owner}/{repo}/importuser access tokens only
- PATCH /repos/{owner}/{repo}/import/authors/{author_id}user access tokens only
- PATCH /repos/{owner}/{repo}/import/lfsuser access tokens only
- POST /repos/{owner}/{repo}/merge-upstream
- POST /repos/{owner}/{repo}/merges
- PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge
- PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge-async
- POST /repos/{owner}/{repo}/releasesalso needs Workflows: Write
- POST /repos/{owner}/{repo}/releasesalso needs Workflows: Write
- PATCH /repos/{owner}/{repo}/releases/assets/{asset_id}
- DELETE /repos/{owner}/{repo}/releases/assets/{asset_id}
- POST /repos/{owner}/{repo}/releases/generate-notes
- PATCH /repos/{owner}/{repo}/releases/{release_id}also needs Workflows: Write
- PATCH /repos/{owner}/{repo}/releases/{release_id}also needs Workflows: Write
- DELETE /repos/{owner}/{repo}/releases/{release_id}
- POST /repos/{owner}/{repo}/secret-scanning/push-protection-bypassesuser access tokens only
- GET /repos/{owner}/{repo}/bypass-requests/push-rules
- GET /repos/{owner}/{repo}/bypass-requests/push-rules/{bypass_request_number}
- GET /repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}
- GET /repos/{owner}/{repo}/stargazersalso needs a permission GitHub's data does not name
- GET /repos/{owner}/{repo}/subscribersalso needs a permission GitHub's data does not name
Roles that include it
- T0OwnerThe organization and every repository in it
- T0All-repository adminEvery repository in the organization
- T1WriteOne repository
- T1MaintainOne repository
- T1AdminOne repository
- T1Collaborator on a personal repositoryOne repository owned by a personal account
- T1All-repository writeEvery repository in the organization
- T1All-repository maintainEvery repository in the organization
Custom role permissions that add it
An owner can build a custom role from these on Enterprise Cloud. Nobody holds one until a custom role with it is assigned.
- Push commits to protected branches
push_protected_branchrepository role - Create protected tags
create_tagrepository role - Delete protected tags
delete_tagrepository role - Bypass branch protections
bypass_branch_protectionrepository role
Classic scopes that reach it
- T0repodocumented
- T1workflowdocumented
- T2public_repostated by GitHub
Attack paths
Techniques it enables
- Push directly, without review Submit malicious code
- Push more commits after approval Submit malicious code
- Approve someone else's PR, then push to it Submit malicious code
- Hide it in a change nobody can review Submit malicious code
- Use a trusted colleague's account Submit malicious code
- Force push or delete a protected branch Delete code or cover tracks
- Delete branches and workflow runs Delete code or cover tracks
- Push a release tag to an unreviewed commit Point a release tag at a bad commit
- Repoint existing tags on a published Action Point a release tag at a bad commit
- Run PR code in a privileged workflow Steal CI secrets and tokens
- Read secrets from the runner Steal CI secrets and tokens
- Trigger the publish workflow from a tampered branch Poison the build or published package
- Release through the project's own pipeline Poison the build or published package
- Plant editor or agent config that runs on open Keep access
Escalations it starts
- Change what an existing workflow runs, get its secrets: The secrets that workflow uses, from the repository and the organization. Environment secrets too, when a job names an environment whose branch policy lets the new branch through and that has no required reviewers.
- Send a repository_dispatch payload to a workflow with secrets: The secrets of the workflow on repository_dispatch, when it trusts the payload.
- Move release tags on a widely used Action: Code execution, with their secrets, in every repository that pins the Action by tag.
Reached through
- Add a collaborator or guest that outlives the attack · from Members: Write (org) or Administration: Write
- Take the workflow token from a runner · from Code already running in a workflow job: a compromised Action, dependency or pull request
- Persist on a non-ephemeral self-hosted runner · from A pull request from a fork that runs on a self-hosted runner that is not wiped between jobs
Abused in
Fixed or limited by
- Enforce MFA for every member (prefer hardware/FIDO2 keys over SMS or app codes)
- Enable audit logging and export it to a SIEM for retention and detection
- Decide which AI coding agents and MCP servers may work on the organization's repositories
- Branch protection on default/release branches: required reviews of the last push + required status checks
- Dependency graph, Dependabot alerts and Dependabot security updates enabled
- Deletion and force-pushes prevented on critical branches
- CODEOWNERS in place, required on sensitive paths
- Rulesets applied: push restriction, tag protection, sensitive file-path protection
- Require signed commits on the default branch of sensitive repos
- Require the committer to match the pusher on sensitive repos
- Make releases immutable, or protect release tags with a tag ruleset
- Set the default GITHUB_TOKEN permission to read-only at the org level
- Require approval for first-time/external contributor workflow runs on forks
- Third-party Actions pinned to a full commit SHA instead of a mutable tag or branch
- Audit every use of pull_request_target and remove or restructure risky ones
- Limit who and what can trigger workflows with workflow execution protections
- Restrict which Actions can run to GitHub-verified creators or an internal allow-list
- Set `persist-credentials: false` on actions/checkout wherever later steps do not push
- Put production secrets in environments with required reviewers
- Limit where workflow jobs can connect to, starting with release and deploy jobs