Skip to content

ci(security): add continuous dependency audit - #2223

Merged
Astro-Han merged 1 commit into
apache:mainfrom
Colafornia:security/dependency-audit
Aug 7, 2026
Merged

Astro-Han merged 1 commit into
apache:mainfrom
Colafornia:security/dependency-audit

Conversation

@Colafornia

@Colafornia Colafornia commented Aug 5, 2026 •

Copy link
Copy Markdown
Member
English

Summary

  • run production dependency audits daily and when dependency inputs or the audit workflow change
  • install only production dependencies with lifecycle scripts disabled before verifying npm registry signatures and attestations
  • block desktop releases on moderate-or-higher production advisories before signing credentials or packaging
  • update transitive Hono to 4.12.34, js-yaml to 4.3.1, and Mermaid to 11.16.1 to clear disclosed production advisories
  • keep bundled third-party notices aligned with the production lockfile

Security boundary

The audit workflow has read-only contents permission and no environment or secrets. Only production dependencies are installed, lifecycle scripts are disabled, and checkout credentials are not persisted. Registry, advisory, and signature failures remain blocking. The release workflow retains its existing structure and changes only the audit threshold from high to moderate.

Verification

  • all PR checks passed, including audit, test_workspaces, typecheck, E2E, Storybook, alignment audit, and Windows packaging
  • actionlint .github/workflows/*.yml — passed
  • dependency audit workflow tests — 5 passed
  • npm ci --ignore-scripts --omit=dev against the official npm registry — passed
  • npm audit --omit=dev --audit-level=moderate against the official npm registry — 0 vulnerabilities
  • npm audit signatures --omit=dev against the official npm registry — 361 signatures and 71 attestations verified
  • npm run check:third-party-notices — passed
  • workflow YAML parsing and git diff --check — passed

Exclusions

This PR does not add CodeQL, Dependabot changes, auto-merge, additional scanners, release-age policy, application behavior changes, or new dependencies.

简体中文

摘要

  • 每日以及 dependency input 或审计 workflow 变化时运行 production dependency audit
  • 只安装 production dependency 并禁用 lifecycle script 后,再验证 npm registry signature 与 attestation
  • desktop release 在使用签名凭证或打包前阻止 moderate 及以上 production advisory
  • 将传递依赖 Hono 更新到 4.12.34、js-yaml 更新到 4.3.1、Mermaid 更新到 11.16.1,清除已披露的 production advisory
  • 同步 desktop 内置第三方许可清单与 production lockfile

安全边界

审计 workflow 只有 contents 只读权限,不使用 environment 或 secrets;只安装 production dependency、禁用 lifecycle script,并且不持久化 checkout credential。Registry、advisory 与 signature verification 失败都会阻止流程。Release workflow 保持原有结构,仅将 audit threshold 从 high 调整为 moderate。

验证

  • PR 全部检查通过,包括 audit、test_workspaces、typecheck、E2E、Storybook、alignment audit 与 Windows packaging
  • actionlint .github/workflows/*.yml — 通过
  • dependency audit workflow tests — 5 项通过
  • 使用 npm 官方 registry 执行 npm ci --ignore-scripts --omit=dev — 通过
  • 使用 npm 官方 registry 执行 production moderate audit — 0 vulnerabilities
  • 使用 npm 官方 registry 执行 signature audit — 验证 361 个 signatures 和 71 个 attestations
  • npm run check:third-party-notices — 通过
  • workflow YAML 解析与 git diff --check — 通过

不在范围内

本 PR 不添加 CodeQL、Dependabot 变更、auto-merge、额外 scanner、release-age 策略、应用行为变更或新依赖。

Part of #2207

@Astro-Han

Copy link
Copy Markdown
Contributor

Thanks for this — I verified the workflow end to end rather than just reading it: npm ci --omit=dev + npm audit --omit=dev --audit-level=moderate (clean), npm audit signatures (62 attestations, no false positives on this lockfile), and both action SHA pins resolve to their stated tags (checkout/setup-node v4.4.0). The gate is real (moderate+ fails the build, no continue-on-error), permissions are minimal, and the governance test locks all of it in deterministically. The hono 4.12.34 bump is a nice catch too — GHSA-8j4g-w8fx-2239 isn't in the npm advisory feed yet, so the bump is what keeps the new gate green the day it lands.

Three non-blocking convention notes and one merge blocker:

  • Merge blocker: the branch currently conflicts with main on package.json — main added scripts/prepare-bundled-git.test.mjs to the test:scripts list after your merge-base, and your scripts/dependency-audit-workflow.test.mjs lands on the same line. Mechanical to resolve (keep both entries) — a quick git merge main or rebase fixes it.
  • P3-1: every other PR-triggered workflow scopes branches: [main]; this one doesn't. Minor noise, easy to match the convention.
  • P3-2: no concurrency: group (all five existing workflows have one) — overlapping runs are cheap here but the convention is one line.
  • P3-3: scheduled runs that go red send no notification; the PR/release gates catch the same advisory so nothing ships silently, but a failure could sit unnoticed for days.

Nothing else blocking — happy to approve.

@Colafornia
Colafornia force-pushed the security/dependency-audit branch from 9c01501 to 8d53b45 Compare August 6, 2026 01:42
@Colafornia

Copy link
Copy Markdown
Member Author

@Astro-Han Thanks for the thorough review. Rebased onto main and resolved the conflict. Added concurrency to cancel superseded runs, while keeping PR scope broad to preserve audit coverage.

Leaving scheduled-failure notifications for a follow-up until we decide where alerts should go.

@Colafornia
Colafornia force-pushed the security/dependency-audit branch from 8d53b45 to 6d9ba03 Compare August 7, 2026 05:54

@Astro-Han Astro-Han 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.

Heads-up: the CI on the rebased head is red on two fronts —

  1. audit job fails for real: the new production-dependency gate immediately found 2 vulnerabilities — js-yaml CVE-2026-59870 (moderate, fix not backported upstream) and the mermaid advisory family (GHSA-3rrr-jr9j-h3q3 prototype pollution, GHSA-2v8p-3f2j-5mp7 / GHSA-rhh3-jpg6-66xh DoS, high). The gate is doing its job; it needs a decision: upgrade/alias the affected deps, or explicitly document an accepted risk before this lands.
  2. test_workspaces fails in a fast script test: [maka-dev] bootstrap failed Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/tmp/maka-boot-ExMCbm/desktop/dist/main/main.js' — a workspace bootstrap test can't find the built desktop main. Worth checking whether this is a flaky ordering issue or something the rebase introduced.

Run daily and dependency-change audits with registry signature verification and enforce the moderate release threshold.

Update Hono past GHSA-8j4g-w8fx-2239 and refresh js-yaml and Mermaid past newly disclosed moderate advisories.

Refs apache#2207
@Colafornia
Colafornia force-pushed the security/dependency-audit branch from 6d9ba03 to 3778eee Compare August 7, 2026 06:28
@Colafornia

Copy link
Copy Markdown
Member Author

@Astro-Han Both CI failures are fixed, and all checks are passed. The new audit gate proved useful by catching newly disclosed vulnerabilities immediately

@Astro-Han
Astro-Han merged commit 5d1ea81 into apache:main Aug 7, 2026
14 checks passed
jackwener added a commit that referenced this pull request Aug 7, 2026
The release audit gate (#2223) blocked the 0.1.8 build on DOMPurify's
IN_PLACE hook removal advisory (moderate), transitive via
@maka/ui -> mermaid. Lockfile moves dompurify to 3.4.13.

Hand-edited three lockfile lines rather than letting npm rewrite the
file: macOS npm strips the libc constraint blocks Linux resolution
depends on (caught in review; the first draft of this PR carried
exactly that stripping).
jackwener added a commit that referenced this pull request Aug 7, 2026
* fix(deps): bump dompurify past GHSA-55q2-fjhq-7xh7

The release audit gate (#2223) blocked the 0.1.8 build on DOMPurify's
IN_PLACE hook removal advisory (moderate), transitive via
@maka/ui -> mermaid. Lockfile moves dompurify to 3.4.13.

Hand-edited three lockfile lines rather than letting npm rewrite the
file: macOS npm strips the libc constraint blocks Linux resolution
depends on (caught in review; the first draft of this PR carried
exactly that stripping).

* chore(licenses): regenerate third-party notices for dompurify 3.4.13
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.

2 participants