← All insights
ENGINEERING JOURNAL / CI/CD Security

GITHUB_TOKEN permissions: trace the event and job

Diagnose Actions authorization with event context, repository policy and job permissions while keeping untrusted pull-request code outside privileged execution.

GITHUB_TOKEN permissions: trace the event and jobGITHUB_TOKEN permissions: trace the event and job — conceptual 3D-style vector showing Workflow event, Repository policy, Job permissions, GITHUB_TOKEN, API operation, Untrusted changes.. Conceptual teaching illustration; connections show the investigation flow rather than a vendor deployment topology.CLOUVENIX / CI/CD SECURITYGITHUB_TOKEN permissions: trace the event and job01Workflow event02Repository policy03Job permissions04GITHUB_TOKEN05API operation06Untrusted changesConceptual investigation flow / GITHUB_TOKEN permissions: trace the event and job
GITHUB_TOKEN permissions: trace the event and job — conceptual 3D-style vector showing Workflow event, Repository policy, Job permissions, GITHUB_TOKEN, API operation, Untrusted changes.

The token's effective permissions depend on context

GitHub supplies a token for workflow access to repository operations. Its effective authority depends on repository or organization policy, workflow and job permission declarations, and the triggering event. A workflow file containing a requested permission does not by itself prove the running job received that authority.

This matters when the same validation workflow runs for trusted pushes and contributions from forks. Code submitted by a contributor is executable input. The workflow should validate it within the intended restricted boundary rather than moving it into a privileged event simply to make a denied API call succeed.

Setup: map the job to its required operation

Record the event, source repository, base repository, branch or ref and workflow revision. List the API actions the job must perform, such as reading contents or publishing a check. Identify which steps execute repository code and which use third-party actions.

Inspect repository and organization defaults and the job's explicit permissions. Keep permissions narrow and scoped to the job that needs them. Review the selected event's documented handling of forks and secrets, including any administrator-controlled exceptions, rather than relying on behavior observed only on an owner's push.

Diagnose an authorization failure

  1. Capture the failing API operation, response status and repository identity without printing the token. Compare the requested endpoint with the permission documented for that operation.
  2. Inspect the effective permission summary and job configuration for the run. Check whether workflow-level defaults were replaced by a job-specific declaration.
  3. Compare a trusted push and a fork pull-request run using their event and source contexts. Preserve the security distinction instead of treating the two as interchangeable experiments.
  4. Separate privileged follow-up operations from execution of untrusted code. If a privileged workflow consumes an artifact or metadata from another run, validate its source, identity and content before acting on it.

Illustrative incident: a publishing step fails only on forks

In this illustrative scenario, a test workflow works for internal branches but fails when its final step tries to write to the repository from a fork pull request. An engineer proposes switching the entire workflow to a more privileged trigger while still checking out and executing the contributor's code.

The team keeps validation restricted and redesigns the privileged reporting path with explicit input checks. It tests both contexts separately. The example illustrates trust preservation and is not a claim about a real compromised repository.

Diagnostic table

ObservationEvidenceBoundary
API call returns forbiddenEndpoint action and effective permissionsToken authority
Only fork runs failTrigger and source contextEvent policy
One job differs from anotherJob-specific permission declarationsPermission inheritance
Fix requires executing untrusted code with secretsCheckout and command flowTrust separation

Correction and verification

Grant only the supported permission the trusted operation needs, and only where the event policy allows it. Verify that third-party actions receive the intended authority and pin their source according to the repository's supply-chain policy. Avoid substituting a broadly privileged personal token without a clear ownership and rotation plan.

Use a test repository or approved controlled branches to exercise the expected event matrix. Confirm successful allowed operations and rejected disallowed writes. Check that logs, outputs and artifacts do not reveal credentials during the failure path.

SOP

Record token-permission ownership, event assumptions and the reason for every write-capable job. Review permissions when adding actions or changing triggers. The runbook should identify a denied operation precisely enough that an engineer can repair its supported access path while retaining the boundary around untrusted pull-request input.

See Clouvenix devsecops security for implementation and operational handover.

Technical reference

Official reference 1; Official reference 2. Documentation checked 20 October 2026; confirm behavior for your deployed edition and version.