When I Wire Up CI/CD, I Assume Automation Steps Will Work and Miss the Permission Boundary
In one sentence: I can write a plausible deployment workflow while mixing execution, resource setup, and permission changes. A passing CI run does not establish correct access, and an authorization failure is not a reason to add an administrator token.
Symptomโ
I add automatic Pages enablement to a deployment, then ask for a broader token when it fails. A deployment task has quietly acquired provisioning authority.
Why this happensโ
GitHub Actions GITHUB_TOKEN permissions depend on enterprise, organization, repository, and event settings; they are not universally read-only by default. Once a workflow or job specifies permissions, omitted permissions become none. Event restrictions, including fork pull requests, still matter.
The current actions/configure-pages enablement feature needs an appropriate token other than the default GITHUB_TOKEN. Its description requires both administration:write and pages:write for a GitHub App; PAT requirements depend on token type and documentation. Requirements on main do not establish those of every historical release.
Consequencesโ
- Deployment fails through insufficient access, or its repair introduces broad, long-lived credentials.
- Untrusted PRs, dependency scripts, or agent inputs can reach unnecessary administrative capabilities.
- Automation has no clear record of who approved initial provisioning or deployment policy changes.
What to do insteadโ
- Separate one-time provisioning from routine deployment. Provision manually or through a separate trusted automation principal; grant deployment only its necessary permissions.
- Specify workflow and job permissions, triggering events, environment approvals, and credential visibility. A token's name is insufficient.
- Pin and check the action version actually used. A complete Pages deployment also needs permissions such as identity tokens according to its deployment documentation, rather than just
pages:write. - Keep management tokens away from untrusted inputs. Unattended CI agents still need isolation, minimal credentials, and reviewed outputs.
Exampleโ
Before (anti-example fragment):
permissions: write-all
# Give routine deployment a management PAT to enable the site.
After (not a complete workflow):
# Prerequisites: Pages is enabled; the build job uploaded a Pages artifact.
permissions: {}
jobs:
deploy:
needs: build
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
steps:
- uses: actions/deploy-pages@v4
This daily-deployment fragment omits triggers, the build job, and initial provisioning. Configure trusted events and environment protection separately. Pin a reviewed action revision according to supply-chain policy in production. This job carries no management PAT and does not use configure-pages enablement.
Version notesโ
Checked GitHub permission documentation and configure-pages main action.yml on 2026-10-29; check the pinned version before deploying. Gemini Action advisory GHSA-wpqr-6v78-jr5g documents a historical headless configuration-trust vulnerability and patched versions. It does not prove that all current CI agents silently trust configuration.