Skip to content

[publish] Add opt-in attest input to compute package provenance attestations - #210

Open
mosuem wants to merge 2 commits into
mainfrom
publish-attest-input
Open

mosuem wants to merge 2 commits into
mainfrom
publish-attest-input

Conversation

@mosuem

@mosuem mosuem commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Note

This PR was generated by an AI coding agent (Jetski) on behalf of @mosuem.

Adds an opt-in attest input (default false) to publish.yml. When set, a new attest job signs the package archive with actions/attest (Sigstore SLSA build provenance) and uploads the bundle as the attestation-bundle workflow artifact. Nothing is passed to pub yet, so this can land before pub.dev accepts attestations.

Part 1 of 2, split out of #199, for package provenance signing (see go/dart-signed-packages). #199 is stacked on this PR and passes the bundle to dart pub publish --with-attestation once pub supports it.

Backwards compatibility

GitHub checks the permissions requested by every job of a reusable workflow against the caller's permissions at startup, including jobs that would be skipped. If any job requested attestations: write, every existing caller that only grants id-token: write (the snippet on dart.dev and pub.dev) would fail with The nested job '…' is requesting 'attestations: write', but is only allowed 'attestations: none'. This is the same problem as with contents: read in #203.

So the attest job:

  • has no permissions: block and inherits the caller's permissions;
  • only runs with attest: true.

Callers that don't opt in get exactly the same jobs and permissions as before (attest is skipped). Callers that opt in must also grant attestations: write.

publish now needs: [package, attest], with a condition that lets it run when attest is skipped. If attest: true and the attestation fails, nothing is published.

Changes

  • publish.yml:
    • New attest input.
    • New attest job: downloads package-archive, runs actions/attest@v4.2.2 on package.tar.gz, and uploads the bundle as package.tar.gz.sigstore.json in the attestation-bundle artifact.
    • publish waits for attest and still runs when attest is skipped.
  • dart.yml: new test_publish_attest job (attest: true, test-run: true). It is skipped for PRs from forks because they can't mint OIDC tokens. Each run creates a real attestation for the example package archive in this repo.
  • CHANGELOG.md: v1.8.3-wip entry.
  • Unrelated fix: the dart-lang/setup-dart pin comments in publish.yml change from # v1 to # v1.8.1, the tag the SHA actually points to. Since v1.8.2 moved the v1 tag, zizmor's ref-version-mismatch audit reports them as Medium findings, and zizmor-output fails for any PR that touches this file (it does on main too).

Example caller workflow

jobs:
  publish:
    permissions:
      id-token: write # Required for OIDC token minting
      attestations: write # Required for `attest: true`
    uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
    with:
      attest: true
      # working-directory: pkgs/package_name # optional, defaults to repository root

…estations

Adds an `attest` input (default `false`) to `publish.yml`. When set, a new
`attest` job signs the package archive with `actions/attest` (Sigstore SLSA
build provenance) and uploads the bundle as the `attestation-bundle` workflow
artifact. The bundle is not passed to `dart pub publish` yet.

The `attest` job has no `permissions:` block and inherits the caller's
permissions: GitHub validates the permissions of every job in a reusable
workflow against the caller's grant (even for skipped jobs), so requesting
`attestations: write` would break existing callers that only grant
`id-token: write`.
The `v1` tag moved to v1.8.2, so zizmor's `ref-version-mismatch` audit flags
the `6afc89d… # v1` pins (which point to v1.8.1).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant