Skip to content

[publish] Generate and attest SBOM using Anchore Syft - #442

Closed
mosuem wants to merge 1 commit into
publish-provenance-supportfrom
publish-sbom-support
Closed

mosuem wants to merge 1 commit into
publish-provenance-supportfrom
publish-sbom-support

Conversation

@mosuem

@mosuem mosuem commented Aug 14, 2026

Copy link
Copy Markdown
Member

Description

Follow-up to #441: This PR integrates Anchore Syft via anchore/sbom-action to automatically generate an SPDX 2.3 JSON Software Bill of Materials (SBOM) from the published package dependency tree, and signs/records an SBOM Attestation with Sigstore using actions/attest@v4.

Changes:

  • .github/workflows/publish.yaml:
    • Added Generate SBOM with Syft step using anchore/sbom-action@v0.24.0 to generate output/sbom.spdx.json.
    • Added Generate SBOM Attestation step using actions/attest@v4 with sbom-path: 'output/sbom.spdx.json'.

Part of the ongoing package signing and supply chain security 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 introduces package provenance signing support and a new --package-only option to package archives without publishing them. The reviewer identified a critical issue in both the packaging and publishing steps: because runCommand is executed with the package's subdirectory as the working directory, using relative paths for the archive file will cause the commands to look for or create the archive in the wrong directory. The reviewer suggests using absolute paths (archiveFile.absolute.path) to resolve this issue.

Comment on lines +231 to +239
final result = await runCommand(
command,
args: [
'pub',
'publish',
'--to-archive=${archiveFile.path}',
],
cwd: package.directory,
);

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.

high

Since runCommand is executed with cwd: package.directory (which is a subdirectory in monorepos), passing the relative path archiveFile.path (e.g., output/package-version.tar.gz) will cause pub publish to write the archive inside the package's subdirectory (e.g., pkgs/package_name/output/...) instead of the repository root's output/ directory.

To ensure the archive is written to the correct location at the repository root, use archiveFile.absolute.path instead.

Suggested change
final result = await runCommand(
command,
args: [
'pub',
'publish',
'--to-archive=${archiveFile.path}',
],
cwd: package.directory,
);
final result = await runCommand(
command,
args: [
'pub',
'publish',
'--to-archive=${archiveFile.absolute.path}',
],
cwd: package.directory,
);

Comment on lines +280 to +289
final result = await runCommand(
command,
args: [
'pub',
'publish',
'--from-archive=${archiveFile.path}',
'--force',
],
cwd: package.directory,
);

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.

high

Similar to the packaging step, since runCommand is executed with cwd: package.directory, passing the relative path archiveFile.path will cause pub publish to look for the archive inside the package's subdirectory (e.g., pkgs/package_name/output/...) instead of the repository root's output/ directory where it was created.

Use archiveFile.absolute.path to ensure the correct absolute path is passed to the command.

Suggested change
final result = await runCommand(
command,
args: [
'pub',
'publish',
'--from-archive=${archiveFile.path}',
'--force',
],
cwd: package.directory,
);
final result = await runCommand(
command,
args: [
'pub',
'publish',
'--from-archive=${archiveFile.absolute.path}',
'--force',
],
cwd: package.directory,
);

@github-actions

github-actions Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

PR Health

Unused Dependencies ✔️
Package Status
None No packages found to check.

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?

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

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.

@mosuem
mosuem force-pushed the publish-sbom-support branch from 008a952 to 8f00e63 Compare August 14, 2026 13:35
@mosuem
mosuem changed the base branch from main to publish-provenance-support August 14, 2026 13:35
@mosuem
mosuem force-pushed the publish-sbom-support branch 17 times, most recently from 66059b2 to ec96d03 Compare August 19, 2026 09:29
@mosuem
mosuem force-pushed the publish-sbom-support branch 4 times, most recently from a5171b9 to cf7a0c6 Compare August 19, 2026 10:21
@mosuem
mosuem force-pushed the publish-sbom-support branch 4 times, most recently from dc2c6be to 8ff68d9 Compare August 19, 2026 10:34
@mosuem
mosuem force-pushed the publish-sbom-support branch from 8ff68d9 to ca57d74 Compare August 19, 2026 10:36
@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

type-infra A repository infrastructure change or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant