Skip to content

Commit ba3dd2a

Browse files
joker23claude
andauthored
ci: fix dependency-scan SBOM workflow to scan released packages (#1287)
## Summary The `dependency-scan.yml` workflow has been silently broken since it was added (SEC-7263, Nov 2025). Every run produces a 0-component SBOM and vacuously passes the license policy check. - **Root cause:** cdxgen internally runs `yarn install` but corepack was never enabled, so it fell back to system yarn 1.x, failed silently, and produced an empty BOM - Enable corepack and install only released package dependencies (via `yarn workspaces focus`) before cdxgen runs - Scopes the scan to published packages only, excluding example apps and contract tests that bring in LGPL-licensed dev tooling (e.g. `@img/sharp-libvips` via Next.js) ## Changes - `.github/workflows/dependency-scan.yml` -- add node setup, corepack, and scoped dependency install before SBOM generation - `scripts/released-packages.js` -- new script that reads `.release-please-manifest.json` and prints workspace names of all released packages ## Test plan - [x] Verified locally: clean checkout (no yarn.lock, no node_modules) produces 970 packages with zero LGPL violations - [ ] Verify the `Dependency Scan` workflow runs green on this PR Fixes SDK-2170 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk since this only changes CI dependency-scanning behavior, but it could cause the `Dependency Scan` workflow to fail if Yarn workspace focusing or the released-packages list is incorrect. > > **Overview** > Fixes the `Dependency Scan` GitHub Action so SBOM generation runs with the intended Node/Yarn toolchain and produces a **non-empty** BOM. > > The workflow now sets up Node 20, enables `corepack`, installs dependencies for *released* workspaces via `yarn workspaces focus $(node scripts/released-packages.js)`, and passes `ensure-non-empty: 'true'` to the SBOM generator. > > Adds `scripts/released-packages.js`, which reads `.release-please-manifest.json` and prints the corresponding workspace package names to drive the focused install. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit d73db95. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 972f90b commit ba3dd2a

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

.github/workflows/dependency-scan.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,25 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1414

15+
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
16+
with:
17+
node-version: 20.x
18+
19+
- name: Enable corepack
20+
run: corepack enable
21+
22+
- name: Install released package dependencies
23+
run: yarn workspaces focus $(node scripts/released-packages.js)
24+
env:
25+
YARN_ENABLE_IMMUTABLE_INSTALLS: 'false'
26+
YARN_ENABLE_SCRIPTS: 'false'
27+
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
28+
1529
- name: Generate SBOM
1630
uses: launchdarkly/gh-actions/actions/dependency-scan/generate-sbom@0a54234f88a428df4163234dbb23ddb7fee8b8ec # main
1731
with:
1832
types: 'nodejs'
33+
ensure-non-empty: 'true'
1934

2035
evaluate-policy:
2136
runs-on: ubuntu-latest

scripts/released-packages.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Prints the workspace names of all released packages, one per line.
5+
* Released packages are those listed in .release-please-manifest.json.
6+
*/
7+
8+
const path = require('path');
9+
10+
const repoRoot = path.resolve(__dirname, '..');
11+
const manifest = require(path.join(repoRoot, '.release-please-manifest.json'));
12+
13+
for (const pkgPath of Object.keys(manifest)) {
14+
const { name } = require(path.join(repoRoot, pkgPath, 'package.json'));
15+
console.log(name);
16+
}

0 commit comments

Comments
 (0)