fleetlint Policy for a fleet of repositories
v0.9
Getting started

release/trusted-publishing

Packages are published with trusted publishing

A capability keyed by published artifact: each kind the release publishes is checked by its own implementation, and every one must pass. Implemented for android-app, apple-app, crate, gem, helm-chart, image, maven, npm, nuget, oci-artifact, pub, pypi, release-files.

Severitywarning
Tiers1
Stacksany
Scoperoot
Kindcapability
Sourcelibrary v0.6.0
Selected byfleetlint-recommended@v0.6.0

Requirement

A workflow that publishes to a registry with trusted publishing (npm, PyPI, crates.io, RubyGems, NuGet, pub.dev) authenticates with it through OIDC: on GitHub the job has id-token: write and no registry token from secrets is passed; on GitLab the pipeline declares id_tokens:. Each artifact kind’s implementation names its publish commands and token variables. Gitea and Forgejo workflows are not checked: the registries do not trust their tokens. Artifacts whose destination has no trusted publishing (forge releases, container registries, Maven Central, app stores) are not checked.

Why

A registry token in CI secrets is valid for months and publishes from anywhere once leaked; an OIDC token is minted per run, scoped to this repository and workflow, and expires in minutes.

Applies when

repo.artifacts.size() > 0

Fix

Register the repository and workflow as a trusted publisher on the registry, grant id-token: write to the release job and delete the token secret.

Agent instruction: Grant id-token: write on the publishing job, remove the registry token from env/with (pypa/gh-action-pypi-publish without password, npm publish with npm 11.5.1 or newer, rust-lang/crates-io-auth-action for cargo, rubygems/release-gem for gems, NuGet/login for nuget.org, dart-lang/setup-dart for pub.dev; on GitLab add id_tokens: with the registry’s audience), and tell the user to register the trusted publisher and delete the secret.

Sources


Generated by fleetlint docs from catalog v0.6.0.