AAK-GHA-PUBLISH-GATE-001
Workflow job publishes a package with no environment approval gate
| Field | Value |
|---|---|
| Severity | HIGH |
| Category | SUPPLY_CHAIN |
| Shipped | v0.6.36 |
| Scanner | agent_audit_kit/scanners/gha_hardening.py |
| OWASP Agentic | ASI04 (Agentic Supply Chain Vulnerabilities) |
| Incident | GHSA-hh7j-5m3j-23pf, @ethersphere/bee-js 13.3.0 (2026-11-09) |
What it catches
A job that publishes a package and names no GitHub environment runs as soon as its trigger fires. Whoever can fire the trigger, or holds a token that can, ships a release nobody approved:
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- run: npm publish --provenance --access public
That is how @ethersphere/bee-js 13.3.0 shipped malware: stolen CI credentials created a GitHub release, the release started the npm publish workflow, and the job published with no approval in 73 seconds. The package carried valid provenance, because provenance records where a package was built, not that anyone reviewed the release.
The rule reads every job in the files directly inside .github/workflows and
reports a job, once, at its first step that publishes, when the job names no
environment:. A step publishes when it:
- uses
pypa/gh-action-pypi-publish,JS-DevTools/npm-publishorrubygems/release-gem, at any ref; - runs
npm,pnpm,yarn,yarn npm,bun,uv,poetry,hatch,flit,pdm,cargo,vsceorovsx publish,twine upload,gem push,nuget pushordotnet nuget push, directly or behindnpx,uvx,pipx run,python -m,sudo,envorVAR=valuewords, with only option words between the program and its subcommand (pnpm -r publish).
The evidence names the job, the command or action, the workflow's triggers and
whether the job has the id-token permission set to write. When a release or
a tag push starts the workflow, it says so: anyone who can create a release or
push a tag publishes with no human in the loop.
What it leaves alone
jobs:
publish:
runs-on: ubuntu-latest
environment:
name: npm-release
url: https://www.npmjs.com/package/example
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- run: npm publish --provenance --access public
- A job that names an environment, as a string or as a mapping with a
name. - A command with
--dry-run,npm pack,npm run publish,git pushanddocker push. - An upload to TestPyPI or to a registry on the runner (
localhost,127.0.0.1), named in the command, in the action'swith:inputs or in anenv:value whose name says it sets the registry.
Limitations
- A named environment counts as the gate. Whether it has required reviewers, or any protection rule, is a repository setting, not in the checkout, so check it in Settings > Environments.
- A job that calls a reusable workflow (
uses:on the job) is not read, nor is a composite action or a script the step runs (./release.sh,npm run release). - A release tool that publishes for you (
changesets/action,semantic-release) is not read. - An option with a value between a program and its subcommand stops the match:
pnpm --filter pkg publishis not read.
How to fix
Put the publishing job behind a GitHub environment and give that environment required reviewers in Settings > Environments, so a release waits for a person before it publishes. Keep the release trigger. For trusted publishing, name the same environment in the PyPI or npm trusted-publisher configuration, so a token is minted only for a run that passed the gate.
Registry reference
This section is generated from the rule registry (agent_audit_kit/rules/builtin.py) when the documentation is built, so it follows the scanner. The rest of the page is hand-written; where the two disagree, the registry is what runs.
- Severity
- HIGH
- Category
- Supply Chain (
supply-chain) - Scanner
agent_audit_kit/scanners/gha_hardening.py- Auto-fixable
- No.
- SARIF name
GhaPublishWithoutEnvironmentGate
What it detects
A job in a GitHub Actions workflow publishes a package (npm publish, twine upload, cargo publish, pypa/gh-action-pypi-publish and the like) and names no environment:. A job that names a GitHub environment waits for that environment's required reviewers before it runs; this one runs as soon as its trigger fires, so whoever can fire the trigger (create a release, push a tag, dispatch the workflow), or holds a token that can, ships a release nobody approved. With id-token: write the package also carries valid provenance, which records where it was built, not that anyone reviewed it. @ethersphere/bee-js 13.3.0 (GHSA-hh7j-5m3j-23pf, 2026-11-09) shipped malware this way: stolen CI credentials created a GitHub release, which started the project's npm publish workflow, and the job published with no approval in 73 seconds.
How to fix (registry)
Put the publishing job behind a GitHub environment (environment: npm-release) and give that environment required reviewers in the repository's Settings > Environments, so a release waits for a person before it publishes. Keep the release trigger. For trusted publishing, name the same environment in the PyPI or npm trusted-publisher configuration, so a token is minted only for a run that passed the gate.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-GHA-PUBLISH-GATE-001
Limitations (registry)
Reads the jobs of the workflow files directly inside .github/workflows and reports each job, once, at its first step that publishes, when the job names no environment (environment: x or environment: {name: x}). A named environment counts as the gate: whether it has required reviewers, or any protection rule, is a repository setting, not in the checkout, and is not checked. A step publishes when it uses pypa/gh-action-pypi-publish, JS-DevTools/npm-publish or rubygems/release-gem (any ref), or when a run: command, joined across backslash continuations and split at ;, &&, || and |, runs npm, pnpm, yarn, yarn npm, bun, uv, poetry, hatch, flit, pdm, cargo, vsce or ovsx publish, twine upload, gem push, nuget push or dotnet nuget push, directly or behind npx, uvx, pipx run, python -m, sudo, env or leading VAR=value words, with only option words (pnpm -r publish) between the program and its subcommand: pnpm --filter pkg publish is not read. A command with --dry-run, or one that names TestPyPI or a registry on the runner (localhost, 127.0.0.1), is not counted, nor is a step whose registry-naming with: input or env: value does. A job that calls a reusable workflow (uses: on the job), a composite action, a script the step runs (./release.sh, npm run release) and a release tool that publishes for you (changesets/action, semantic-release) are not read, and neither are image pushes (docker push). The trigger and id-token: write shape only the evidence. A workflow file over 1 MB is not read.
References
- OWASP Agentic Top 10: ASI04 (Agentic Supply Chain Vulnerabilities)
- Incidents and advisories: GHSA-hh7j-5m3j-23pf
- CSA AI Controls Matrix (AICM): STA-08