---
title: "Publish your packages without stored · Agent Wranglers"
url: https://agentwranglers.se/playbook/open-source/releases/trusted-publishing
id: OSS-46
level: Recommended
updated: 2026-10-27
build: a2a6bdfed830
tokens: 1019
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Publish your packages without stored tokens

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Releases](https://agentwranglers.se/playbook/open-source/releases.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-27.

- ID: OSS-46
- Level: Recommended
- Chapter: [Releases](https://agentwranglers.se/playbook/open-source/releases.md)
- Rule: Publish your own packages only from the build server through trusted publishing, with two-factor login on every maintainer account. Keep no long-lived publish token anywhere.
- Check: Search the build settings, the secrets store and each maintainer's `~/.npmrc` and `~/.pypirc` for publish tokens. None is found. A publish attempt with a classic token is refused by the registry.
- How: Skip this rule when you publish no packages. Registries such as npm and PyPI accept a short-lived OIDC token from a named build workflow instead of a stored token. Then set the package to require two-factor login and refuse tokens, as npm's settings allow. In 2025, a worm stole publish tokens from developer machines and pushed infected versions of other packages. Maintainers use phishing-resistant factors, as [Offer two-factor login](https://agentwranglers.se/playbook/accounts/second-factors-and-recovery/two-factor-login.md) describes.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### YAML example

```yaml
# .github/workflows/release.yml
permissions:
  contents: read
  id-token: write
jobs:
  publish:
    runs-on: ubuntu-latest
    environment: release
    steps:
      - uses: actions/checkout@<full-commit-hash>
      - run: npm ci && npm publish
```

## Sources

- [npm Docs on trusted publishing](https://docs.npmjs.com/trusted-publishers/)
- [CISA alert on the npm supply chain compromise](https://www.cisa.gov/news-events/alerts/2025/09/23/widespread-supply-chain-compromise-impacting-npm-ecosystem)

## Related rules

- ENG-11 [Build releases only in CI and verify them before deploy](https://agentwranglers.se/playbook/engineering/ci-and-supply-chain/build-in-ci-and-verify.md) in Engineering
- OSS-12 [Keep at least two people who can publish](https://agentwranglers.se/playbook/open-source/maintainers-and-governance/two-publishers.md) in Open source maintenance
- OSS-18 [Build every release in CI with signed provenance](https://agentwranglers.se/playbook/open-source/releases/release-provenance.md) in Open source maintenance
- ACC-70 [Offer two-factor login](https://agentwranglers.se/playbook/accounts/second-factors-and-recovery/two-factor-login.md) in Accounts and identity
- OSS-21 [Let a second maintainer approve each release](https://agentwranglers.se/playbook/open-source/releases/release-approval.md) in Open source maintenance
- DEV-10 [Check every release against the public API](https://agentwranglers.se/playbook/developer-tools/libraries-and-sdks/semver-check.md) in Developer tools, SDKs and CLIs
- DEV-19 [Pin the checksum in every package manager manifest](https://agentwranglers.se/playbook/developer-tools/distribution/package-manager-checksums.md) in Developer tools, SDKs and CLIs

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/open-source/releases/trusted-publishing">Agent Wranglers open source maintenance playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Build every release in CI with signed provenance](https://agentwranglers.se/playbook/open-source/releases/release-provenance.md)
- Next: [Tell users how to verify a release](https://agentwranglers.se/playbook/open-source/releases/verification-instructions.md)
- [Releases](https://agentwranglers.se/playbook/open-source/releases.md)
