Skip to content

[publish] Add experimental provenance input and flag for package signing - #441

Closed
mosuem wants to merge 29 commits into
mainfrom
publish-provenance-support
Closed

mosuem wants to merge 29 commits into
mainfrom
publish-provenance-support

Conversation

@mosuem

@mosuem mosuem commented Aug 14, 2026 •

Copy link
Copy Markdown
Member

Just an idea re dart-lang/pub-dev#5750 . The pub client currently doesn't support uploading the attestation, so this currently goes nowhere, but if dart pub publish would support that it would work immediately.

Also has a follow up #442 for the SBOM.

what do you think? @athomas @jonasfj @sigurdm

Description

This PR adds initial support for package provenance signing to the reusable publish workflow and firehose bot, hidden behind an experimental --provenance / provenance: true flag.

Changes:

  • .github/workflows/publish.yaml:
    • Added provenance input (boolean, defaults to false).
    • Added attestations: write permission to the publish job.
    • Added package archive step (firehose --package-only).
    • Added artifact attestation step using actions/attest@v4.
    • Forwarded the --provenance flag to firehose --publish.
  • pkgs/firehose:
    • Added --package-only and --provenance flags to CLI arguments and Firehose constructor.
    • When --package-only is invoked, packages the .tar.gz archive to output/<package>-<version>.tar.gz using dart pub publish --to-archive=....
    • When --provenance is active during publishing, publishes from the prepared archive via dart pub publish --from-archive=....
    • Added unit tests for Firehose(provenance: ...).
    • Updated CHANGELOG.md.

Part of the ongoing package signing and provenance verification initiative for pub.dev.

@github-actions github-actions Bot added package:firehose type-infra A repository infrastructure change or enhancement labels Aug 14, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for package provenance signing by introducing a --provenance option. When enabled, packages are first bundled into a temporary archive before being published. The review feedback suggests wrapping the temporary directory cleanup inside the finally block in a try-catch block to prevent potential cleanup errors from masking original exceptions.

Comment thread pkgs/firehose/lib/firehose.dart Outdated
Comment on lines +344 to +346
} finally {
await tempDir.delete(recursive: true);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If an exception is thrown in the try block, and another exception occurs during the cleanup in the finally block (for example, if tempDir.delete fails due to file locking on Windows), the original exception will be masked and lost. To prevent this exception masking and ensure easier debugging, wrap the cleanup call in a try-catch block to safely handle and log any cleanup errors.

      } finally {
        try {
          await tempDir.delete(recursive: true);
        } catch (e) {
          print('Failed to delete temporary directory: $e');
        }
      }

@github-actions

github-actions Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

PR Health

Unused Dependencies ✔️
Package Status
firehose ✔️ All dependencies utilized correctly.

For details on how to fix these, see dependency_validator.

This check can be disabled by tagging the PR with skip-unused-dependencies-check.

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
firehose Non-Breaking 0.13.0 0.13.2-wip 0.13.2-wip ✔️

This check can be disabled by tagging the PR with skip-breaking-check.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbol Leaking sources

This check can be disabled by tagging the PR with skip-leaking-check.

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

License Headers ✔️
// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

This check can be disabled by tagging the PR with skip-license-check.

Coverage ✔️
File Coverage
pkgs/firehose/lib/firehose.dart 💚 0 % ⬆️ Infinity %

This check for test coverage is informational (issues shown here will not fail the PR).

This check can be disabled by tagging the PR with skip-coverage-check.

name: package-archive
path: output/

publish:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it common to split the building and generating the attestation into different jobs? I'd have expected that the attestation is generated by the build.

https://github.com/actions/attest#usage says to use attest in the same workflow (which you're doing) but doesn't say if you should or shouldn't split build and attestation into separate jobs. All the examples seem to have build and attestation in the same job.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read in the SLSA docs that the build step should not have access to the secrets from the attestation step. In our case the build is just zipping files, so maybe its fine?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I says "The build platform MUST guarantee the following", so I'd say it's GHA that needs to guarantee that. I don't know (and couldn't find anything in the GHA documentation) if the job boundary is a stronger security boundary than the step boundary.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two jobs does mean two different VMs, while two steps don't. Also the permissions are different for the jobs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand it, we could make reusable workflow that we know will only run pub publish without running any untrusted code or code from the author of the package.

Then said job could both create archive, attest and publish.

But if we want to run code from the package author, yes, two jobs is probably the best option.

The job doing the attention should be trusted so keys can't be exfiltrated.

mosuem added 21 commits August 19, 2026 09:35
@mosuem
mosuem force-pushed the publish-provenance-support branch from 41e10d2 to bba1780 Compare August 19, 2026 09:36
@mosuem

mosuem commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

Close in favor of dart-lang/setup-dart#199

@mosuem mosuem closed this Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package:firehose type-infra A repository infrastructure change or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants