What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

A GitHub Actions workflow can use a repository-scoped token, explicitly supplied secrets, and—if configured—an identity a cloud provider may trust. That does not make every workflow privileged: its authority depends on the event, repository and organization settings, permissions, and what the workflow actually runs. To secure one, trace which code is trusted, which credentials it can reach, and which policies constrain its execution.

What authority does a GitHub Actions workflow have?

Start with the job, not just the workflow file. GitHub creates a unique GITHUB_TOKEN for each workflow job. It is a GitHub App installation token scoped to the repository containing the workflow, and its usable permissions depend on the permissions granted to it. A workflow can also pass secrets to a job or step, and a job configured for OpenID Connect (OIDC) can request a JWT for a cloud provider to evaluate.

These are separate routes to authority. A token can permit actions against the repository; a secret can be a credential for another service; and an OIDC token can lead to cloud access only if the provider accepts its identity. A trigger alone does not tell you what a job can do.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I limit GITHUB_TOKEN permissions?

Declare permissions explicitly at the workflow or job level, and grant only what that workflow needs. An empty permission set is a useful starting point when a job does not need repository-token access; add only the required permission for jobs that do. If jobs need different access, set permissions at the job level so a job that needs more does not grant it to every other job.

#1 Best Overall

Do not treat the absence of a visible token input as proof that an action cannot use the token. GitHub Docs states: “An action can access the GITHUB_TOKEN through the github.token context even if the workflow does not explicitly pass the GITHUB_TOKEN to the action.” Review each action and the code it invokes in its execution context, not only the inputs listed in the workflow.

  • Read the workflow-level and job-level permissions settings.
  • Inspect actions, scripts, and commands that run in each job, including their dependencies and configuration.
  • Ask whether each step needs repository access at all, and whether its token permissions can be narrower.

Are pull_request and pull_request_target equally safe?

No. They use different trust contexts, especially for contributions from forks. The important question is not only which event starts a workflow, but whether untrusted contribution code is later checked out, interpreted, or executed in a job that has access to trusted credentials.

Event Workflow and trust context Credentials and main risk
pull_request Runs the merge-commit workflow in the pull request context. For fork pull requests, the token is read-only by default and other secrets are withheld. Fork approval policies can also limit compute abuse. Review the actual repository settings.
pull_request_target Uses workflow code from the base repository’s default branch, with base-repository trust. Secrets and a more privileged token can be available. The dangerous boundary crossing is checking out and executing fork code in that privileged context.

When to use pull_request

Prefer pull_request for ordinary pull-request checks when the job does not need extra secrets or write permissions. Fork restrictions reduce the impact of untrusted contributions, but they are not a reason to ignore what a workflow runs or the repository’s configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When pull_request_target is necessary

This event can support trusted automation such as pull-request triage, but keep contribution content as data. Do not run the fork’s scripts, build instructions, package installation, or other executable content in the privileged job. GitHub’s checkout protections have explicit opt-outs and do not cover every way untrusted content can enter a job: review manual fetches, third-party repositories, and downloaded artifacts as well.

Build and dependency steps deserve scrutiny even when the workflow itself is on a trusted branch. A script, dependency, configuration file, or artifact can provide an execution path for attacker-controlled content. Check what each step consumes and whether it can execute that content while credentials are available.

When can an action access secrets?

Secrets are not automatically made available to every action. A workflow must explicitly include a secret for the relevant job or step. Keep exposure narrow: pass only what that specific work needs rather than making credentials broadly available across unrelated steps.

For sensitive deployments, environment secrets can be gated by required reviewers. That gate can delay access until approval, but it does not make careless secret handling safe. Avoid printing credentials or values derived from them. GitHub log redaction is not guaranteed for every transformation, so do not rely on masking as a complete defense.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How does OIDC change cloud credentials?

Where supported, OIDC can replace long-lived cloud credentials stored as GitHub secrets. A job requests a JWT, and the cloud provider decides whether that identity may be exchanged for cloud access. Granting id-token: write only enables JWT retrieval; it does not itself grant access to cloud resources.

Configure the provider’s trust conditions narrowly. Restrict accepted identities to the relevant repository and, where appropriate, a branch, environment, or other relevant identity attributes. Set id-token: write only on jobs that need it, and separately limit the cloud role or permissions the provider grants after validating the identity.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Which policies can restrict workflow execution?

Workflow-level permissions are only one layer. Organization, enterprise, and repository administrators can also configure policies that restrict which actors or events may run workflows. Check the effective policy and any exceptions for the repository you are auditing; do not assume a general rule applies unchanged to every repository.

GitHub documentation retrieved October 7, 2026, said the default pull_request_target event policy was in evaluate mode for affected public repositories, with enforcement scheduled for November 2, 2026. The documented default applies only to public repositories without an already applicable Actions event policy; it does not apply to private or internal repositories and does not replace an existing applicable policy. Because the stated enforcement date is close and policy status can change, administrators should inspect policy insights and confirm the effective setting. If the event is required, configure an applicable allowance deliberately; otherwise consider whether a safer event can replace it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How should self-hosted runners fit into the audit?

A job’s authority also depends on the machine that executes it. Treat self-hosted runner isolation and reuse as part of the trust boundary. GitHub specifically warns that privileged event workflows need properly restricted, non-reused ephemeral runner environments. If untrusted code can run on a machine that retains access or state from earlier work, limiting the workflow token alone does not address that exposure.

A practical workflow audit

  1. Map triggers to trust. For each event, identify who can cause it and whether that actor can change the code or workflow being run.
  2. Trace execution paths. Follow checkout, scripts, build steps, package installation, dependencies, configuration, fetched repositories, and downloaded artifacts. Mark anything an untrusted contributor can influence.
  3. Review token permissions. Read workflow- and job-level permissions, reduce grants to the minimum each job needs, and inspect actions for access through the github.token context.
  4. Map credentials to steps. Identify every secret and where it is explicitly exposed. Check whether sensitive environment secrets require reviewer approval, and remove logging that could reveal credentials or derived values.
  5. Constrain cloud identity. For OIDC deployments, limit which job can request a JWT and verify the cloud provider’s repository, branch, environment, or other relevant trust conditions.
  6. Check administrative controls. Inspect applicable actor and event policies, policy insights, and exceptions at the repository, organization, and enterprise levels.
  7. Inspect runner boundaries. Confirm where privileged jobs execute, whether that compute is isolated, and whether self-hosted environments are ephemeral rather than reused.

A useful final check is to write down, for each job, the code it trusts, the credentials it can reach, the permissions those credentials provide, and the policy or approval that constrains execution. Any unexplained access or untrusted code path is a reason to redesign the workflow before relying on its trigger name as a safeguard.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.