← Back to the cybersecurity blog

GitHub Actions security: lockfiles, pull_request_target, token permissions and detection

By Thilina Manana · COO, Director Técnico de Seguridad hard2bit y socio fundador · Published: 16 November 2026 · Updated: 16 November 2026
GitHub Actions security

On 14 March 2025 someone repointed most of the version tags of the tj-actions/changed-files action to a commit carrying a script that dumped every run's secrets into the build log. SecurityWeek, reporting StepSecurity's findings, put the action's footprint at more than 23,000 repositories. None of them had to edit a workflow to be exposed. Referencing the action by tag was enough.

The tj-actions incident, the Shai-Hulud worm (which registered the compromised developer machine as a self-hosted runner) and the waves of fake workflows pushed with stolen maintainer accounts all exploit the same weakness. GitHub Actions runs third-party code with an organisation's credentials, and many organisations set their defaults long before the controls that now contain that risk existed. Between August 2025 and October 2026 GitHub shipped mandatory SHA pinning, workflow dependency lockfiles and execution protections, and on 2 December 2026 it will start blocking the pull_request_target trigger by default in public repositories on GitHub.com.

This guide is written for the platform or security lead of a company running a GitHub.com organisation with somewhere between a few dozen and a few hundred repositories. It explains what each setting controls, the value to choose and how to confirm through the API that it is in force. The audit log detections require GitHub Enterprise Cloud, as their section explains. The technical names quoted here were checked against GitHub's documentation on 16 November 2026; GitHub Enterprise Server lags behind on several of these features.

What runs in a GitHub Actions workflow, and with which credentials?

A GitHub Actions workflow is a YAML file under .github/workflows that GitHub executes on a runner, the machine that carries out the jobs, when an event fires: a push, a pull request, a comment, a schedule. Each step is either an in-house script or an action published by someone else, referenced as owner/repo@ref. Two questions decide the risk: whose code ends up running, and which credentials are within reach while it does.

What permissions does the GITHUB_TOKEN get on each run?

Every job receives a short-lived GITHUB_TOKEN scoped to the repository: read-only by default in organisations created since 2 February 2023, read and write in older ones unless changed by hand. On 2 February 2023 GitHub switched the default to read-only, but only for new enterprises and organisations; new repositories inherit their organisation's setting. Older organisations kept read and write unless someone changed it by hand, and in our assessments it is one of the first gaps to surface.

On top of that token sit whatever secrets the repository, environment or organisation exposes: cloud keys, package registry credentials, personal access tokens doing duty as service accounts. These are non-human identities holding standing privileges, and a compromised workflow can read all of them at once.

Why does a tag reference not fix an action's version?

A reference such as actions/checkout@v7 points at a git tag, and whoever controls the action's repository can repoint it. That is what happened with tj-actions, and in 2026 the TeamPCP campaign showed again that a security tool sitting in the build pipeline can be the way in. Composite actions add a second layer, since one action can call others, and pinning the first level leaves those transitive dependencies unpinned. GitHub's secure use reference recommends pinning to a full-length commit SHA and checking that the SHA comes from the action's own repository and not from a fork.

When does pull_request_target run untrusted code with secrets?

When the workflow checks out the pull request's code and builds, tests or installs it with the base repository's token and secrets. pull_request_target exists so that maintainers can automate chores such as labelling or triage on pull requests from forks. It runs in the context of the base repository, with its token and its secrets. By default it takes both the workflow and the code from the default branch, so no fork code runs. GitHub's pull_request_target guidance calls this a pwn request and warns that workflow_run and issue_comment can produce the same outcome.

Command injection needs no checkout at all. A pull request title, a branch name or a comment body is interpolated through a ${{ }} expression into a shell script, and text written by an outsider gets executed. GitHub's advice is to route such values through environment variables instead of interpolating them, and to treat artefacts and caches coming from other workflows as untrusted.

How can self-hosted runners and artefacts leak the token?

A runner that survives the job allows persistence, and an artefact holding the git config can carry the token out. GitHub-hosted runners are torn down after each job. A self-hosted runner may not be, and GitHub says they should almost never serve public repositories, because anyone can open a pull request and gain a persistent foothold on the machine. Shai-Hulud registered the compromised developer machine as a self-hosted runner in a repository it controlled, a trick that Elastic turned into a detection rule, and the npm worm that abused Claude Code hooks took the same route from package to pipeline.

In 2024 Palo Alto Unit 42 described a quieter leak, ArtiPACKED: actions/checkout stored the token in the local git config, so a workflow that uploaded its whole working directory as an artefact shipped the token with it. Since version 6, the actions/checkout README says credentials go to a separate file under $RUNNER_TEMP, which closes that leak path; workflows pinned to older versions may still leak it if they upload the directory as an artefact. upload-artifact has also excluded hidden files by default since v4.4.0.

Where does the evidence of a compromised workflow land?

In the organisation audit log, which records changes to configuration and to secrets. It also logs runner registrations and the write rejections the platform enforces. GitHub keeps 180 days of events, and seven days of git events. It does not record what each step did internally; that requires the workflow's own run logs and, on self-hosted runners, host telemetry.

Which controls come first for a mid-sized organisation?

First the read-only token and the runner restriction, then the lockfile, SHA pinning and fork approval. The table covers those that apply at organisation level; the last column gives an indicative priority.

Decision matrix for GitHub Actions controls at organisation level
ControlWhat it stopsRollout frictionKnown limitPriority
Read-only default tokenRepository writes using a compromised workflow's tokenLow to medium: workflows that publish or comment without declaring permissions breakDoes not protect secrets or stop a workflow requesting moreNow, after an inventory
Self-hosted runners limited to selected repositoriesPersistence on company machines via public repositoriesLow with few runners; repositories left off the list lose their runnersCovers repository-level runners only; organisation runners are scoped through runner groups. Does not harden the runnerNow
Approval for outside contributors' runsAutomatic execution of fork codeMedium for busy open-source projectsUnder the first-time options, returning contributors skip approval; does not apply to pull_request_targetHigh
Mandatory SHA pinningRepointed tags on third-party actionsMedium: unpinned workflows failLeaves transitive dependencies and tag-referenced reusable workflows floatingHigh
Lockfile with Require lockfileRepointed tags and transitive dependenciesMedium: a new tool in the change processReusable workflow dependencies follow their own repository's lockfile; does not judge safetyHigh for deploying repositories
Allowed and blocked actions listUnknown actions or withdrawn versionsHigh at first, because of the inventoryNeeds ongoing upkeepMedium
Event policy for pull_request_targetPwn requests from forksLow in private repositoriesDefault block covers public repositories onlyHigh for public repositories
OIDC with environment-bound conditionsLong-lived cloud keys stored as secretsMedium: changes on the cloud sideA loose condition extends trust to other repositoriesHigh for deploying repositories
CODEOWNERS on .github/workflowsUnreviewed workflow changesLowOnly bites if branch protection requires the review; gates merges, not runs of branches that can read secretsMedium

Indicative priority for an organisation with tens to a few hundred repositories. Sources: GitHub documentation and changelog, consulted on 16 November 2026.

SHA pinning and the lockfile tackle the same problem with different reach: a SHA in the workflow file fixes the first level and is visible in review, while the lockfile also fixes transitive dependencies, and GitHub says it makes in-file pinning unnecessary where adopted. For an organisation starting today, we would use the lockfile on repositories holding production credentials and keep SHA pinning as the safety net everywhere else.

How is each setting rolled out and verified through the API?

Each setting below can be read through the Actions permissions REST API. Querying it with gh api from an account with organisation admin rights produces dated evidence that serves the team and an auditor alike. In the examples, ORG stands for the organisation's name.

What should the default GITHUB_TOKEN permission be?

In the organisation's Actions settings, the default workflow permission should be read and the option that lets Actions create and approve pull requests should be unticked. The API exposes them as default_workflow_permissions and can_approve_pull_request_reviews. Before switching, the workflows that cut releases, post comments or push without declaring permissions need finding, because they will stop working.

# Default token permissions for the organisation.
# Expected: default_workflow_permissions "read" and can_approve_pull_request_reviews false.
gh api /orgs/ORG/actions/permissions/workflow
# The same setting exists per repository; each one needs checking.
gh api /repos/ORG/REPO/actions/permissions/workflow

Each workflow should declare its permissions explicitly. The tidiest pattern grants no permissions at workflow level and gives each job only what it uses. A read-only default does not stop a workflow from asking for permissions: write-all, so reviewing the YAML still matters:

# Workflow level: no permissions by default.
permissions: {}
# Per job, only what each one uses (excerpt without runs-on or steps).
jobs: {build: {permissions: {contents: read}}, deploy: {permissions: {contents: read, id-token: write}}}

How are SHA pinning and action blocking enforced?

Since August 2025 the allowed actions policy has two extra controls. A tick box enforces full-SHA pinning, so any workflow that uses an unpinned action fails, and a ! prefix blocks a given action or version. Reusable workflows can still be referenced by tag. The blocklist is evaluated last and overrides any allow rule, which means a compromised action can be cut off across every repository in one edit.

# Organisation actions policy.
# Expected: allowed_actions "selected" (or "local_only") and sha_pinning_required true.
gh api /orgs/ORG/actions/permissions

Ticking the box, or moving to an allowlist, without an inventory breaks every workflow still using tags or unlisted actions. A static analyser such as zizmor helps beforehand: it flags unpinned references, excessive permissions and risky triggers in each repository's workflows without executing code, so covering the organisation means looping over its repositories.

Which risks does a workflow dependency lockfile cover?

Repointed tags and floating transitive dependencies: a lockfile fixes the commit of every action and GitHub verifies it on each run. Lockfiles entered public preview on 14 October and became generally available on 28 October 2026 on the Free, Team and Enterprise Cloud plans. The file lives at .github/workflows/actions.lock, is produced by the official CLI extension and should never be hand-edited. At run time, GitHub also checks the owner and repository IDs of the source. When Dependabot bumps an action in a workflow already covered by the lockfile, it regenerates that entry in the same pull request.

# Install the official extension and generate the lockfile for all workflows.
gh extension install github/gh-actions-lock
gh actions-lock
# In CI: check that the lockfile is current without rewriting it (needs network access and GH_TOKEN).
gh actions-lock --verify

According to GitHub's guide to locking workflow dependencies, if a tag moves upstream the run keeps using the recorded commit and the extension reports an error so that someone reviews the change before accepting it. Onboarding also rewrites references to the exact version resolved, so @v3 may become @v3.1.0. The allowed actions list is then matched against the locked SHA, so tag-based entries stop matching and must be replaced with wildcards or full SHAs.

The Require lockfile policy can be set at enterprise, organisation or repository level. In active mode it blocks runs of targeted workflows that are not covered by the lockfile; the report-only evaluate mode is available on GitHub Enterprise alone. Hands-on tests published by Classmethod found that a dependency added without updating the file fails the run before any job starts. Reusable workflows depend on the lockfile in their own repository, which is why GitHub recommends onboarding shared workflow repositories first.

When will GitHub block pull_request_target by default?

From 2 December 2026, in public GitHub.com repositories only. An event policy already in place takes precedence over that default rule.

Execution protections, generally available since 17 September 2026, let enterprises, organisations and repositories define who may trigger a workflow and with which events. Each rule can be targeted at specific workflow files, and an Insights view shows what would have been blocked. Building on that, GitHub will block pull_request_target by default on 2 December 2026 in public repositories hosted on GitHub.com. GitHub scheduled two brownouts beforehand, on 9 and 16 November between 16:00 and 18:00 UTC.

Teams that rely on the trigger will have to allow it explicitly in an event policy, ideally scoped to the one workflow file that needs it. Private and internal repositories sit outside the default block, and in our assessments that is often where legacy workflows linger. A custom execution protection rule that allows pull_request_target only in the files that justify it confines the exposure to those files, which still need review.

actions/checkout adds another barrier. According to GitHub's changelog, version 7 (18 June 2026) and, since 20 July 2026, the floating major tags of supported versions except v1 refuse to fetch fork code in pull_request_target, and in workflow_run when a pull request triggered it; issue_comment is not covered. Workflows pinned to a SHA, minor or patch version without the change do not get it, and the protection does not cover fork code pulled in with git or the GitHub CLI from a run step. In review, allow-unsafe-pr-checkout: true always needs checking, because it is the explicit way around that barrier.

Who approves runs from fork pull requests?

A maintainer, when approval_policy requires it; two settings also decide what happens to code arriving from a fork:

# Who needs approval before fork workflows run.
# Recommended for public repositories: all_external_contributors.
gh api /orgs/ORG/actions/permissions/fork-pr-contributor-approval
# Forks of private repositories.
# Expected: send_write_tokens_to_workflows false and send_secrets_and_variables false.
gh api /orgs/ORG/actions/permissions/fork-pr-workflows-private-repos

approval_policy takes three values, from loosest to strictest: first_time_contributors_new_to_github, first_time_contributors and all_external_contributors. With all_external_contributors, every run triggered by an outsider waits for a maintainer's approval. For private repositories, the response also carries run_workflows_from_fork_pull_requests and require_approval_for_fork_pr_workflows, which decide whether those runs happen at all and whether they need approval. Approval does not apply to pull_request_target, which runs regardless.

Which repositories may use self-hosted runners?

Only in a closed list of non-public repositories. The organisation setting decides which repositories may register their own runners; organisation-level runners are scoped through runner groups, which also need checking:

# Which repositories may register repository-level runners.
# Expected: enabled_repositories "selected" or "none".
gh api /orgs/ORG/actions/permissions/self-hosted-runners
# Organisation runner groups.
# Expected: allows_public_repositories false and, where possible, restricted_to_workflows true.
gh api /orgs/ORG/actions/runner-groups

Public repositories should stay off that list, which also needs comparing with the runners in use today so that none is cut off by surprise. Where runners are allowed, ephemeral mode, which destroys the runner after each job, an EDR agent on the host and monitoring of its outbound connections supply the visibility the audit log lacks. A runner with a route into the internal network should be treated like any other exposed server.

Why replace stored cloud credentials with OIDC?

Long-lived cloud credentials stored as secrets are the usual prize in these attacks. With OpenID Connect the workflow asks GitHub for a signed token on each run and exchanges it for short-lived credentials in the target cloud. The job needs id-token: write, and GitHub's OIDC reference requires at least one condition on the trust relationship so that unrelated repositories cannot obtain tokens, alongside a check on the audience (aud). Binding trust to an environment is the most useful option, using the default sub claim format (if the organisation customised the claim template, the format differs):

# Condition on the sub claim in the cloud provider's trust policy.
# Accepts tokens only from the produccion environment of one repository.
repo:my-org/my-repo:environment:produccion

The environment has to be protected for the condition to mean anything. GitHub's environments reference says that with required reviewers a job cannot reach the environment's secrets until a reviewer approves it. Preventing self-review and limiting deployment branches to "Selected branches and tags" stop a workflow launched from an arbitrary branch from getting that far.

Without Enterprise Cloud, required reviewers only protect public repositories; administrators can also bypass environment rules unless that option, on by default, is switched off. On checkout, persist-credentials: false keeps the token off disk, out of reach of later steps and uploaded artefacts:

# Pinned checkout step that does not leave credentials for later steps.
- { uses: actions/checkout@FULL-SHA, with: { persist-credentials: false } }

Knowing which secrets exist, who uses them and when they were last rotated is the starting point we set out in our guide to non-human identities, service accounts and tokens.

Organisation secrets should be limited to the repositories that use them, and reusable workflows should receive each secret explicitly instead of through secrets: inherit.

Who reviews changes to .github/workflows?

Adding .github/workflows/ to CODEOWNERS and requiring code owner review in the default branch's protection means no workflow change lands without someone from platform or security seeing it. Without that requirement in the protection rule, CODEOWNERS only assigns reviewers and blocks no merge.

Even then it gates merges, not runs: anyone with write access can push a branch whose workflow reads repository and organisation secrets. Deployment credentials therefore belong in environment secrets restricted to selected branches, and the CODEOWNERS rule should cover all of .github/, including CODEOWNERS itself and actions.lock. Organisation rulesets apply the same requirement across every repository without exceptions.

Can the audit log reveal GitHub Actions abuse?

Yes, with four KQL queries for Microsoft Sentinel and one Sigma rule, all requiring GitHub Enterprise Cloud. The queries below target Microsoft Sentinel and the GitHubAuditLogsV2_CL table fed by the GitHub Enterprise audit log connector built on the Codeless Connector Framework (CCF). Its connector listing states that it needs GitHub Enterprise Cloud, operates at enterprise level and requires an enterprise admin with a classic token carrying the read:audit_log scope. An organisation on Free or Team cannot use these queries as written: its audit log is reviewed from the organisation settings, and automated detection requires an Enterprise Cloud plan.

Column names (Action, Actor, Repo, ActorIp, ProgrammaticAccessType, UserAgent, Reasons) follow the published schema for that table, a community catalogue that matches the official connector files in the Azure-Sentinel repository. If ingestion lands in another table, the names need checking before any rule is enabled. ActorIp is only populated if the enterprise enables IP address display in the audit log.

Event names come from GitHub's audit log events reference and from rules published by Elastic, SigmaHQ and Panther. Before these queries reach production, the approach in our detection engineering guide helps measure what they cover and what slips past.

Who changed token permissions or environment rules?

The query lists 30 days of changes to the default token permission, environment rules, rulesets and branch protection.

// Token permission changes, environment rule edits, ruleset changes and branch protection overrides.
GitHubAuditLogsV2_CL
| where TimeGenerated > ago(30d)
| where Action endswith "set_default_workflow_permissions" or Action endswith "set_workflow_permission_can_approve_pr" or Action in ("environment.update_protection_rule", "environment.remove_protection_rule", "environment.delete", "protected_branch.policy_override", "protected_branch.destroy", "repository_ruleset.update", "repository_ruleset.destroy")
// Who, from where and with what kind of access.
| project TimeGenerated, Action, Actor, Repo, ActorIp, ProgrammaticAccessType, UserAgent
| order by TimeGenerated desc

This is a periodic review query, not an alert, since a scheduled Sentinel rule cannot look back more than 14 days: each row ought to match a planned change. False positives are legitimate admin changes, which can be trimmed by joining against the change calendar. A non-empty ProgrammaticAccessType on a governance change deserves scrutiny, because it means a token made the change, not a person in the web interface. GitHub describes the environment protection rule events as API changes, so a test environment should show what a reviewer change made in the web interface logs.

When should a runner registration raise an alert?

When the actor registered no runner in the previous 14 days. The query includes just-in-time (JIT) runners, which GitHub logs under a different event:

// Actors who added runners between 14 days ago and yesterday.
let known = GitHubAuditLogsV2_CL
| where TimeGenerated between (ago(14d) .. ago(1d))
| where Action endswith ".register_self_hosted_runner" or Action endswith ".configure_self_hosted_jit_runner"
| distinct Actor;
// Registrations ingested in the last hour; run hourly with a 14-day query period.
GitHubAuditLogsV2_CL
| where ingestion_time() > ago(1h)
| where Action endswith ".register_self_hosted_runner" or Action endswith ".configure_self_hosted_jit_runner"
// Exclude known actors.
| where Actor !in (known)
| project TimeGenerated, Action, Actor, Repo, RunnerName, ActorIp, UserAgent

This mirrors Elastic's New Terms rule type, which fires on the first value never seen before in a field (Elastic uses a five-day history). The expected false positive is a planned registration by a platform engineer doing it for the first time. Two false negatives stand out: a token stolen from an engineer who already registers runners looks like a known actor, and a runner added to a personal repository never reaches the organisation's log. The allowed-repositories list limits where a runner can be registered; a change to that policy (org.update_repo_self_hosted_runners_policy) or to runner groups deserves the same scrutiny.

Why watch Actions secrets changed through a token?

Because a programmatic change outside documented rotation points to credential theft or tampering.

// Repository, environment or organisation Actions secrets changed through a token.
GitHubAuditLogsV2_CL
| where TimeGenerated > ago(1d)
| where Action endswith "_actions_secret"
| where isnotempty(ProgrammaticAccessType)
// Group by hour to surface bursts.
| summarize changes = count(), actions = make_set(Action), repos = make_set(Repo) by Actor, ActorIp, ProgrammaticAccessType, bin(TimeGenerated, 1h)

The suffix filter catches creation, updates and removal at all three levels, including repo.create_actions_secret and org.update_actions_secret, among others. Automated rotation, where it exists, will fire this daily and can be excluded by actor and source once documented. Changes made in the web interface carry no token details, so the field stays empty.

Are tokens trying to modify workflows without permission?

The protected_branch.rejected_ref_update event with reason workflow_updates reveals them.

// Rejections for creating or editing a workflow without the workflows permission.
GitHubAuditLogsV2_CL
| where TimeGenerated > ago(1d)
| where Action == "protected_branch.rejected_ref_update"
| where Reasons contains "workflow_updates"
| summarize attempts = count() by Actor, Repo, bin(TimeGenerated, 1h)

Elastic builds its GitHub Actions Workflow Modification Blocked rule on this event. The workflow_updates reason appears when a GitHub App token, including the GITHUB_TOKEN, which never holds that permission, tries to create or change a workflow, the signature of compromised automation trying to leave a backdoor behind. The usual false positives are update bots such as Dependabot or Renovate and in-house scripts that manage workflows.

Can the runner detection be written in Sigma?

Yes: this rule flags registrations at repository, organisation or enterprise level.

title: GitHub self-hosted runner registered
id: 753a1f66-3599-4e59-af23-707a0d83544e
status: experimental
description: Alerts when a self-hosted runner is registered in a repository, organisation or enterprise.
references: ['https://www.elastic.co/docs/reference/security/prebuilt-rules/rules/integrations/github/initial_access_github_register_self_hosted_runner']
author: Hard2bit
date: 2026-11-16
logsource: {product: github, service: audit, definition: 'Requires the GitHub Enterprise Cloud audit log via streaming or API.'}
detection: {selection: {action: ['repo.register_self_hosted_runner', 'org.register_self_hosted_runner', 'enterprise.register_self_hosted_runner']}, condition: selection}
# Common false positives.
falsepositives: ['Planned registrations by the platform team']
level: medium
tags: [attack.initial-access, attack.persistence, attack.t1195.002, attack.t1078.004]

SigmaHQ maintains a broader rule, GitHub Self Hosted Runner Changes Detected, which also covers removals and runner group changes; the version above sticks to registrations to keep alert volume manageable, and leaves out JIT runners, which are noisy without a baseline.

Can detections be validated without attacking anything?

Yes, by reproducing legitimate events in a test environment. Validation belongs in a private test repository inside an organisation that belongs to the enterprise the connector reads; otherwise no event reaches the table. Registering a runner on a disposable machine and removing it with config.sh remove produces the runner query's event. Creating and deleting an environment secret with gh secret set --env and gh secret delete feeds the secrets query, and changing that repository's default token permission and restoring it triggers the governance query. For the workflow query, a test workflow with contents: write that pushes a change under .github/workflows/ using the GITHUB_TOKEN produces the rejection.

Ingestion takes roughly 15 to 30 minutes: if the alert does not fire, the first check is whether the event reached the table, then the query. The runner query only fires if whoever registers the runner had not done so in the previous 14 days.

On the preventive side, gh actions-lock --verify and zizmor in CI, set as required checks, stop pull requests with a stale lockfile or an over-privileged workflow from being merged. Which logs reach the SIEM, together with GitHub's 180-day retention, sets how far back an investigation can go; our guide on which logs to send to the SIEM covers that choice.

One more alert is needed for ingestion health: if GitHubAuditLogsV2_CL goes two hours without rows, an expired classic token may have blinded every rule above.

Where do the controls fall short?

Each control leaves a documented gap; these come up most often.

  • A pinned SHA may not belong to the action at all: a commit from a fork resolves under the same path, which is why GitHub recommends verifying the source.
  • Dependabot raises no alerts for vulnerable SHA-pinned actions, according to GitHub's own guidance.
  • A checkout SHA from a release without the change (pre-v7, or before the July 2026 backport) misses its refusal to fetch fork code; the pin needs moving to a version that includes it.
  • A lockfile is not a safety verdict. GitHub notes it freezes what is there without assessing it, and dependencies of reusable workflows follow the lockfile in their own repository. Container images are not locked and need pinning by @sha256 digest, and a lockfile change that rolls a reference back to an older commit is not flagged, so lockfile diffs need review.
  • An allowlist written with tags stops matching as soon as the repository adopts the lockfile.
  • The audit log will not show what a step did. Without run logs and telemetry on company-run runners, exfiltration inside a legitimate job leaves no trace there.

Most of the friction comes from mandatory pinning, the allowlist and Require lockfile in active mode, since all of them fail workflows. Rolling them out repository by repository, beginning with those that deploy to production, keeps day one from ending with dozens of blocked teams.

Does this configuration count as ENS, ISO 27001 and NIS2 evidence?

Yes: dated gh api output, active detection rules and the policy configuration all work as evidence under the frameworks Spanish and European auditors usually ask about. The mapping is indicative and should be aligned with each organisation's statement of applicability.

Indicative mapping of GitHub Actions controls to ENS, ISO 27001:2022 and NIS2
ControlENS (RD 311/2022)ISO/IEC 27001:2022 Annex ANIS2 Art. 21(2)
Lockfile, SHA pinning and actions listop.ext.3 Supply chain protection (HIGH category); at MEDIUM and BASIC, op.exp.3 Security configuration management5.21 Managing information security in the ICT supply chainPoints (d) supply chain security and (e) security in acquisition, development and maintenance
Read-only token, per-job permissions, OIDCop.acc.2 Access requirements and op.acc.4 Access rights management process8.2 Privileged access rights, 5.18 Access rights and 8.5 Secure authenticationPoint (i) access control policies
Organisation policies verified via APIop.exp.3 Security configuration management8.9 Configuration managementPoint (e) security in acquisition, development and maintenance
CODEOWNERS and mandatory workflow reviewop.exp.5 Change management and op.acc.3 Segregation of duties (not applicable at BASIC)8.25 Secure development life cycle, 8.32 Change management and 8.4 Access to source codePoint (e)
Audit log in the SIEM and queriesop.exp.8 Activity logging and op.mon.3 Monitoring8.15 Logging and 8.16 Monitoring activitiesPoint (b) incident handling

Mapping prepared by Hard2bit from each framework's text; it does not replace the auditor's interpretation.

The joint NSA and CISA guidance on defending CI/CD environments provides a vendor-neutral reference if an auditor asks for justification of the threat model. Our DevSecOps team works on these settings and their evidence, and our managed SOC can run the detections.

Where should work start if there is time for only one thing this week?

If there are public repositories, the first job is to check Insights for pull_request_target runs the 2 December default would block. After that, we would start by listing the repositories that hold production credentials, which in a mid-sized company tend to be few, and onboarding their workflows to the lockfile with Require lockfile active on those alone. That control would have neutralised the tj-actions pattern, provided nobody regenerated the lockfile during the attack window, a pattern repeated in later supply chain attacks, and its friction falls mainly on teams that already manage deployments.

A read-only token and the runner restriction can follow once the workflow inventory confirms what would break: two configuration changes, verified with two API calls. On that footing, the rest of the matrix can be rolled out one repository at a time.

Sources and methodology: GitHub's official documentation and changelog; rules published by Elastic, SigmaHQ and Panther; the connector files in the Azure-Sentinel repository and the community Microsoft Sentinel schema catalogue; research by StepSecurity (via SecurityWeek), Unit 42, Datadog Security Labs and Classmethod; and the joint NSA and CISA guidance on CI/CD. Technical names checked as of 16 November 2026.
Disclaimer: this guide sets out settings and detection queries checked against the cited vendors' public documentation as of 16 November 2026. GitHub Actions changes often, so current documentation should be reviewed and policies trialled in a test repository before any change, and the queries need adapting to each organisation's SIEM schema. The content is for information only and does not replace an assessment of each environment; Hard2bit cannot accept liability for disruption arising from applying these settings without that prior validation.

Frequently asked questions

Is the GITHUB_TOKEN read-only in every organisation? ▾

No. It depends on when the organisation was created. Those created from 2 February 2023 start read-only; older ones kept read and write unless changed by hand. One call to gh api /orgs/ORG/actions/permissions/workflow settles it, and the check should be repeated per repository, since the setting also exists at that level.

How does SHA pinning differ from a workflow lockfile? ▾

Pinning protects the action named in the file; the lockfile protects the whole tree, including the actions that action calls, and checks that the source repository is still the same one. In exchange, dependencies of reusable workflows are left to the lockfile of the repository that defines them, and adopting it forces a rewrite of any allowlist built on tags.

Will the 2 December pull_request_target block affect private repositories? ▾

No. It covers public repositories hosted on GitHub.com, not private or internal ones, nor GitHub Enterprise Server. In private repositories the risk remains wherever workflows check out fork code, so the trigger is best restricted with an execution protection rule to the workflows that need it. An event policy already in place takes precedence over the default rule.

Which GitHub audit log events should a SOC watch first? ▾

For persistence, self-hosted runner registrations, JIT runners included, at repository, organisation or enterprise level. For credential theft, any Actions secret event performed with a token. For governance tampering, changes to default token permissions and environment rules, and branch protection overrides.

Do these queries work on the GitHub Team plan? ▾

Not as written. The Sentinel connector feeding GitHubAuditLogsV2_CL requires GitHub Enterprise Cloud and an enterprise admin with a token carrying read:audit_log. On Team the audit log is reviewed from the organisation settings; the preventive controls in this guide remain available.

Can Require lockfile break production workflows? ▾

Yes, if it is switched on before every workflow is onboarded: uncovered runs simply do not start, and only GitHub Enterprise offers a trial first in evaluate mode. On Free and Team, a repository-by-repository rollout after generating and reviewing the file is the safer route, with repositories holding reusable workflows onboarded first.

How do these controls fit an ENS or ISO 27001 audit? ▾

The lockfile and actions list serve as evidence for ENS op.ext.3 at HIGH category (op.exp.3 at MEDIUM and BASIC) and ISO 27001:2022 control 5.21; token permissions for op.acc.2, op.acc.4 and 8.2; mandatory workflow review for op.exp.5 and 8.32; audit log ingestion into the SIEM for op.exp.8, op.mon.3, 8.15 and 8.16. Dated gh api output documents the configuration.

Want a straight answer on scope, priorities and price?

Most organizations reach us mid-question: something needs fixing, nobody has scoped it, and finance wants a number. Thirty minutes with a technical consultant — not a salesperson — gets you a defined scope, priorities ranked by risk and a price range. With what comes out of that call, we turn it into a fixed proposal. We work with organizations in Spain, across the EU and in LATAM.

If your situation is different, tell us anyway — we also take one-off questions on cybersecurity and regulatory compliance.

Based in Spain · Working across the EU and LATAM · ENS High · ISO 27001 · We usually reply in under 24 business hours