← All permissions
Repository permission·contents:read
Contents: Read
Tier 3 · Low
Why Tier 3
Reads code, commits, branches, tags and releases. On a private repository this is the source code itself.
Data plane permissions start at Tier 2. This one is lowered for the reason above.
Can reach T1 when the repository is private and has credentials committed in its code or history (its secret scanning alerts show whether it does).
Inferred from: GitHub Docs: secret scanning
- 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: readWorkflow scopes by tier
What it unlocks
49 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 /markdown
- GET /repos/{owner}/{repo}/activity
- GET /repos/{owner}/{repo}/branches
- GET /repos/{owner}/{repo}/branches/{branch}
- GET /repos/{owner}/{repo}/code-scanning/codeql/databases
- GET /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}
- GET /repos/{owner}/{repo}/code-scanning/codeql/variant-analyses/{codeql_variant_analysis_id}
- GET /repos/{owner}/{repo}/code-scanning/codeql/variant-analyses/{codeql_variant_analysis_id}/repos/{repo_owner}/{repo_name}
- GET /repos/{owner}/{repo}/codeowners/errors
- GET /repos/{owner}/{repo}/commits
- GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head
- POST /repos/{owner}/{repo}/commits/{commit_sha}/comments
- GET /repos/{owner}/{repo}/commits/{ref}
- GET /repos/{owner}/{repo}/community/profile
- GET /repos/{owner}/{repo}/compare/{basehead}
- GET /repos/{owner}/{repo}/contents/{path}
- GET /repos/{owner}/{repo}/dependency-graph/compare/{basehead}
- GET /repos/{owner}/{repo}/dependency-graph/sbom
- GET /repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}
- GET /repos/{owner}/{repo}/dependency-graph/sbom/generate-report
- GET /repos/{owner}/{repo}/dismissal-requests/secret-scanningalso needs Secret scanning alert dismissal requests: Read and Secret scanning alerts: Read and Secret scanning alert dismissal requests: Read
- GET /repos/{owner}/{repo}/dismissal-requests/secret-scanningalso needs Secret scanning alert dismissal requests: Read and Secret scanning alerts: Read and Secret scanning alert dismissal requests: Read
- GET /repos/{owner}/{repo}/dismissal-requests/secret-scanning/{alert_number}also needs Secret scanning alerts: Read
- PATCH /repos/{owner}/{repo}/dismissal-requests/secret-scanning/{alert_number}also needs Secret scanning alert dismissal requests: Write and Secret scanning alerts: Read and Secret scanning alert dismissal requests: Write
- PATCH /repos/{owner}/{repo}/dismissal-requests/secret-scanning/{alert_number}also needs Secret scanning alert dismissal requests: Write and Secret scanning alerts: Read and Secret scanning alert dismissal requests: Write
- POST /repos/{owner}/{repo}/forksalso needs Administration: Write and Repository creation: Write
- POST /repos/{owner}/{repo}/forksalso needs Administration: Write and Repository creation: Write
- GET /repos/{owner}/{repo}/git/blobs/{file_sha}
- GET /repos/{owner}/{repo}/git/commits/{commit_sha}
- GET /repos/{owner}/{repo}/git/matching-refs/{ref}
- GET /repos/{owner}/{repo}/git/ref/{ref}
- GET /repos/{owner}/{repo}/git/tags/{tag_sha}
- GET /repos/{owner}/{repo}/git/trees/{tree_sha}
- GET /repos/{owner}/{repo}/importuser access tokens only
- GET /repos/{owner}/{repo}/import/authorsuser access tokens only
- GET /repos/{owner}/{repo}/import/large_filesuser access tokens only
- GET /repos/{owner}/{repo}/pulls/{pull_number}also needs Pull requests: Read
- GET /repos/{owner}/{repo}/readme
- GET /repos/{owner}/{repo}/readme/{dir}
- GET /repos/{owner}/{repo}/releases
- GET /repos/{owner}/{repo}/releases/assets/{asset_id}
- GET /repos/{owner}/{repo}/releases/latest
- GET /repos/{owner}/{repo}/releases/tags/{tag}
- GET /repos/{owner}/{repo}/releases/{release_id}
- GET /repos/{owner}/{repo}/releases/{release_id}/assets
- GET /repos/{owner}/{repo}/tarball/{ref}
- GET /repos/{owner}/{repo}/zipball/{ref}
- POST /repos/{template_owner}/{template_repo}/generatealso needs Administration: Write and Repository creation: Write
- POST /repos/{template_owner}/{template_repo}/generatealso needs Administration: Write and Repository creation: Write
Roles that include it
- T0OwnerThe organization and every repository in it
- T0All-repository adminEvery repository in the organization
- T1WriteOne repository
- T1MaintainOne repository
- T1AdminOne repository
- T1Security managerThe organization and every repository in it
- T1All-repository writeEvery repository in the organization
- T1All-repository maintainEvery repository in the organization
- T1Enterprise security managerEvery organization in the enterprise
- T2TriageOne repository
- T2ModerateOne repository
- T2All-repository triageEvery repository in the organization
- T3ReadOne repository
- T3All-repository readEvery repository in the organization
Classic scopes that reach it
- T0repodocumented
- T1security_eventsdocumented
- T2public_repodocumented
Attack paths
Techniques it enables
- Search the repository and its history for keys Steal CI secrets and tokens
- Clone private repos with a stolen token Read or expose private code
- Get an agent to copy private code into public Read or expose private code
Abused in
Fixed or limited by
- Set an organization-wide maximum PAT lifetime (90 days is a reasonable default)
- Audit and revoke stale PATs, unused SSH keys, and inactive accounts
- Disable classic PATs organization-wide, forcing migration to fine-grained PATs
- Review every currently installed GitHub App / OAuth App and its granted scope
- Keep OAuth app access restrictions on and require security/IT approval for new apps
- Enforce an IP allow list for Git and web UI access from trusted ranges
- Secret scanning and push protection enabled
- Write and rehearse a credential-rotation runbook before you need it
- Cloud credentials migrated from static keys to OIDC federation, scoped to repo + branch
- Service-account automation migrated from PATs to GitHub Apps