Zum Inhalt springen
ecdsa.com
npm publish --provenance (npm 9.5+)Paketmanager

Fehlermeldung

Automatic provenance generation not supported for provider: null

Auch ausgegeben als

  • Provenance generation in GitHub Actions requires "write" access to the "id-token" permission
  • Provenance generation in GitLab CI requires "SIGSTORE_ID_TOKEN" with "sigstore" audience to be present in "id_tokens".

In GitHub Actions ohne `permissions: id-token: write` lautet die Meldung „Provenance generation in GitHub Actions requires "write" access to the "id-token" permission“ (beides mit npm 11.19.1 reproduziert); in GitLab ohne den Eintrag `id_tokens` nennt sie `SIGSTORE_ID_TOKEN` (Text aus dem Quellcode von libnpmpublish). Alle sind Fehler mit dem Code `EUSAGE`. Der Providername stammt aus der CI-Erkennung von npm (`ci-info`).

npm publish --provenance (npm 9.5+) — libnpmpublish, code EUSAGE

Was der Fehler bedeutet

`npm publish --provenance` erzeugt ein signiertes SLSA-Provenance-Statement, das angibt, welcher CI-Workflow das Paket gebaut hat. Das kann npm nur innerhalb eines unterstützten CI-Systems, das eine OIDC-Identität bereitstellt (GitHub Actions auf von GitHub gehosteten Runnern, GitLab CI auf Shared Runnern); diese Identität trägt Sigstore in das Signaturzertifikat ein. `provider: null` bedeutet, dass npm überhaupt keine CI erkannt hat – der Befehl lief auf einem Entwicklungsrechner oder in einer nicht unterstützten CI. Es wurde nichts veröffentlicht.

Warum der Fehler auftritt

So behebst du den Fehler

  1. 1.

    Aus einem Workflow in GitHub Actions veröffentlichen

    Erteile `id-token: write`, lass den Job auf einem von GitHub gehosteten Runner laufen und veröffentliche mit `--provenance`. Mit Trusted Publishing von npm (OIDC) kann das npm-Token ganz entfallen.

    yaml
    name: release
    on: { release: { types: [published] } }
    permissions:
      contents: read
      id-token: write          # lets npm obtain the OIDC token Sigstore needs
    jobs:
      publish:
        runs-on: ubuntu-latest   # GitHub-hosted runner
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-node@v4
            with: { node-version: 24, registry-url: "https://registry.npmjs.org" }
          - run: npm ci
          - run: npm publish --provenance --access public
            env: { NODE_AUTH_TOKEN: "${{ secrets.NPM_TOKEN }}" }
  2. 2.

    Oder aus GitLab CI

    Fordere unter `id_tokens` ein ID-Token mit der Audience `sigstore` an; npm liest es aus `SIGSTORE_ID_TOKEN`.

    yaml
    publish:
      image: node:24
      id_tokens:
        SIGSTORE_ID_TOKEN:
          aud: sigstore
      script:
        - npm publish --provenance --access public

Verwandte Fehler

Gesamte Signaturfehler-Datenbank durchsuchen