Skip to content

ci: audit npm dependencies in Security Audit, and clear main's high and critical advisories - #242

Merged
jamesyong-42 merged 2 commits into
mainfrom
ci/pnpm-audit
Oct 27, 2026
Merged

jamesyong-42 merged 2 commits into
mainfrom
ci/pnpm-audit

Conversation

@jamesyong-42

@jamesyong-42 jamesyong-42 commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

truffle's Security Audit checked Go (govulncheck), cargo-deny and cargo-audit, but nothing read pnpm-lock.yaml. main therefore carried 107 npm advisories unseen: 2 critical (tar, proxy-addr), 63 high, 34 moderate and 8 low. #233's push audit found them.

This PR adds a pnpm audit job and clears every high and critical advisory. After it, pnpm audit --audit-level=high exits 0, with 4 advisories left below the gate.

The job (ci: commit)

  • pnpm-audit in security-audit.yml runs pnpm audit --audit-level=high against the lockfile alone. Nothing is installed, so no package script runs.
  • Every workspace importer counts, including the examples and benchmark/app.
  • Pull requests that touch any package.json, pnpm-lock.yaml or pnpm-workspace.yaml now run the workflow, alongside its existing triggers.

Where the high and critical findings came from (main dc9db0d)

Importer Paths Through
examples/playground 48 electron-builder 25 (tar 6, @xmldom/xmldom, app-builder-lib, builder-util-runtime, brace-expansion, form-data, tmp, http-cache-semantics, …), electron 41, electron-vite beta (browserslist)
benchmark/app 7 vite 8.0.8 (vite, postcss, nanoid, source-map-js)
root 5 @typescript-eslint, through eslint (brace-expansion 5)
crates/truffle-napi 3 @napi-rs/cli 3.6.2 (js-yaml 4.1.1)
examples/express-over-mesh 2 express 4.21 (proxy-addr, critical; body-parser)

The bumps (chore(deps): commit)

  • examples/playground:
    • electron ^41.2.2 → ^44.9.3 (resolves 44.10.0). The 41 line has an advisory patched only at ≥42.11.16. From 42 on, electron unpacks with @electron-internal/extract-zip instead of extract-zip, which has no patched version.
    • electron-builder ^25.1.8 → ^26.18.0 (app-builder-lib ≥26.15.0; tar 7.5.22).
    • electron-vite 6.0.0-beta.1 → ^6.0.0.
  • @napi-rs/cli 3.6.2 → 3.10.9 (js-yaml 5.5.0). It still builds the napi 3.15 family from chore(deps): move the napi crates together (napi 3.15.0, napi-derive 3.6.13) #235. It regenerates crates/truffle-napi/index.d.ts with one added declaration, __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'. The generated index.js loader is gitignored but ships in @vibecook/truffle-native, and from the next release it is 3.10.9's loader, which exports that constant.
  • In range (pnpm update raised the floors to what it resolved): vite ^8.3.5; express ^4.22.3 (proxy-addr 2.0.8, body-parser 1.20.9); @typescript-eslint/eslint-plugin, @typescript-eslint/parser and typescript-eslint ^8.72.1.
  • Now resolved: tar 7.5.22, @xmldom/xmldom 0.8.15, js-yaml 4.3.2 and 5.5.0, brace-expansion 1.1.21, 2.1.7 and 5.0.12, browserslist 4.29.5, http-cache-semantics 4.3.0, source-map-js 1.2.2, postcss 8.5.32, nanoid 3.3.20, form-data 4.0.6, tmp 0.2.7, builder-util-runtime 9.7.0.
  • No pnpm.overrides. The lockfile was regenerated by pnpm, never edited by hand.
    • The steps: install --lockfile-only, update, then a remove and re-add of electron-builder, then dedupe.
    • The re-add is there because electron-builder's auto-installed electron-builder-squirrel-windows peer stayed locked at 25.1.8 through update, and it kept the whole app-builder-lib 25 tree alive.

Left below the gate

Severity Package Through Patched
low esbuild 0.27.7 benchmark/app > vite ≥0.28.1
moderate vitest / @vitest/mocker 4.1.4 (2 advisories) root > vitest ≥4.1.12

Tests

Run locally on 2026-10-27 (macOS arm64, pnpm 10.20.0) as CI check runs them. Every step exited 0:

  • pnpm install --frozen-lockfile --ignore-scripts
  • pnpm run release:check, pnpm run lint, pnpm run format:check
  • pnpm run build: all six packages, including napi build --platform --release with CLI 3.10.9 and the playground's electron-vite build
  • pnpm run test
  • pnpm --filter @vibecook/example-playground typecheck
  • pnpm audit --audit-level=high: exit 0, with 4 vulnerabilities (1 low, 3 moderate)

A choice for review

electron 44 rather than 45. 45.0.0 was published on 2026-10-21. 42.11.18, 43.8.3, 44.9.3 and 45.0.0 all came out that day with the same fixed dependency set, so 44 is the mature line that clears the audit.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

jamesyong-42 and others added 2 commits October 27, 2026 11:10
The weekly Security Audit covered Go (govulncheck), cargo-deny and
cargo-audit, but nothing read pnpm-lock.yaml, so main carried 107 npm
advisories (63 high, 2 critical) unseen; #233's push audit found them.

- New job `pnpm-audit`: `pnpm audit --audit-level=high` against the
  lockfile alone (nothing installed, so no package script runs); every
  workspace importer counts, examples and benchmark/app included.
- Pull requests that touch any package.json, pnpm-lock.yaml or
  pnpm-workspace.yaml now trigger the workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`pnpm audit` on main (dc9db0d) found 107 advisories: 2 critical, 63 high,
34 moderate, 8 low. After this commit, `pnpm audit --audit-level=high`
exits 0 with 4 left, all below the gate (1 low esbuild, 3 moderate vitest).

- examples/playground: electron ^41.2.2 -> ^44.9.3 (44.10.0); the 41 line
  has an advisory patched only at >=42.11.16, and from 42 on electron
  unpacks with @electron-internal/extract-zip, which drops extract-zip.
  electron-builder ^25.1.8 -> ^26.18.0 (app-builder-lib >=26.15.0, tar 7);
  electron-vite 6.0.0-beta.1 -> ^6.0.0.
- @napi-rs/cli 3.6.2 -> 3.10.9 (js-yaml 5). It regenerates index.d.ts
  with one added declaration, `__napiBindingTarget`, and the generated,
  gitignored index.js loader that ships in @vibecook/truffle-native
  carries it from the next release.
- In range, the floors raised by `pnpm update`: vite ^8.3.5, express
  ^4.22.3 (proxy-addr 2.0.8, body-parser 1.20.9), @typescript-eslint/*
  and typescript-eslint ^8.72.1.
- The lock was regenerated by pnpm and never edited by hand:
  `install --lockfile-only`, `update`, then electron-builder removed and
  re-added (its auto-installed squirrel-windows peer stayed at 25.1.8 and
  kept app-builder-lib 25 alive), then `dedupe`. No overrides.
- Locally (pnpm 10.20.0): frozen install, release:check, lint, format,
  build, test, and the playground typecheck all exit 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jamesyong-42
jamesyong-42 merged commit 5a8f88b into main Oct 27, 2026
14 checks passed
@jamesyong-42
jamesyong-42 deleted the ci/pnpm-audit branch October 27, 2026 21:14
jamesyong-42 pushed a commit that referenced this pull request Nov 1, 2026
#242 bumped @napi-rs/cli 3.6.2 -> 3.10.9 in crates/truffle-napi/package.json
and regenerated pnpm-lock.yaml, but not the standalone npm lockfile that the
NAPI Build workflow installs with `npm ci`. The 0.7.25 release's NAPI Build
failed on every target ("lock file's @napi-rs/cli@3.6.2 does not satisfy
@napi-rs/cli@3.10.9"), so @vibecook/truffle-native@0.7.25 was never published
and the npm publish timed out waiting for it.

Regenerated with `npm install --package-lock-only --ignore-scripts`;
`npm ci` now installs @napi-rs/cli 3.10.9, and check-release-versions passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JZwaBuXD1phVAJsq2NMXu5
jamesyong-42 added a commit that referenced this pull request Nov 1, 2026
#242 bumped @napi-rs/cli 3.6.2 -> 3.10.9 in crates/truffle-napi/package.json and pnpm-lock.yaml but not in the standalone npm lockfile that NAPI Build installs with `npm ci`, so the 0.7.25 NAPI Build failed on every target and @vibecook/truffle-native@0.7.25 was never published.

Regenerated with `npm install --package-lock-only --ignore-scripts`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JZwaBuXD1phVAJsq2NMXu5
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