Repository navigation
Conversation
There was a problem hiding this comment.
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.
| } finally { | ||
| await tempDir.delete(recursive: true); | ||
| } |
There was a problem hiding this comment.
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');
}
}
PR HealthUnused Dependencies ✔️
For details on how to fix these, see dependency_validator. This check can be disabled by tagging the PR with Breaking changes ✔️
This check can be disabled by tagging the PR with 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.
This check can be disabled by tagging the PR with Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with License Headers ✔️
All source files should start with a license header. This check can be disabled by tagging the PR with Coverage ✔️
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 |
| name: package-archive | ||
| path: output/ | ||
|
|
||
| publish: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Two jobs does mean two different VMs, while two steps don't. Also the permissions are different for the jobs.
There was a problem hiding this comment.
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.
…to publish workflow
41e10d2 to
bba1780
Compare
|
Close in favor of dart-lang/setup-dart#199 |
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 publishwould 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
firehosebot, hidden behind an experimental--provenance/provenance: trueflag.Changes:
.github/workflows/publish.yaml:provenanceinput (boolean, defaults tofalse).attestations: writepermission to thepublishjob.firehose --package-only).actions/attest@v4.--provenanceflag tofirehose --publish.pkgs/firehose:--package-onlyand--provenanceflags to CLI arguments andFirehoseconstructor.--package-onlyis invoked, packages the.tar.gzarchive tooutput/<package>-<version>.tar.gzusingdart pub publish --to-archive=....--provenanceis active during publishing, publishes from the prepared archive viadart pub publish --from-archive=....Firehose(provenance: ...).CHANGELOG.md.Part of the ongoing package signing and provenance verification initiative for pub.dev.