Skip to content

🐛 fix: npm audit gate documents, matches and reports package-scoped exceptions - #526

Merged
hivecommons-hive[bot] merged 2 commits into
mainfrom
scanner/fix-523
Oct 30, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
mainfrom
scanner/fix-523

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closes #523
Closes #524
Closes #525

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

…eptions

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify

netlify Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for hivecommons-docs failed. Why did it fail? →

Name Link
🔨 Latest commit df74571
🔍 Latest deploy log https://app.netlify.com/projects/hivecommons-docs/deploys/6ae41a6ee2d6b62a5c46dad5

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

hive/awaiting-ci: CI pending — sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Oct 30, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is correct; the only thing blocking this is Prettier.

Checked against the tree:

  • scripts/npm-audit-gate.ts:131 pkg || "*" — with exceptionKey(ex.id, ex.package) at :163 and the lookup at :175-177 (scoped key first, then unscoped fallback), an exception with package: "" now lands under ID:* and matches every affected package. That is the pre-#521 behaviour #524 asks for; the new test at npm-audit-gate.test.ts:187-191 pins it.
  • :249 the unused warning prints (${ex.package || "*"}), and the main test at :425 asserts (nope) for the scoped entry — consistent with #525.
  • Header docstring (:15-18) covers #523. Changelog fragment name follows fixed-<issue>-….

Why CI is red — the diff's fault, one-line fix: the TypeScript & ESLint job fails at npm run format:check:

[warn] scripts/npm-audit-gate.test.ts
Code style issues found in the above file. Run Prettier with --write to fix.

npm-audit-gate.test.ts:425 is 91 columns against printWidth: 80 in .prettierrc. Prettier wants the regex on its own line:

    expect(out).toMatch(
      /::warning::Unused npm audit exception GHSA-zzzz-zzzz-zzzz \(nope\)/
    );

The Netlify failures are the deploy preview and derive from the same job, not from the content. Once npx prettier --write scripts/npm-audit-gate.test.ts is pushed this looks correct to me.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Oct 30, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

The four red Netlify contexts (deploy-preview, Pages changed, Header rules, Redirect rules) are a shared repository incident, not this PR: main's own deploy errors the same way (skipped, no build). Tracked in #527; deferring Netlify-related repair here until it closes. TypeScript & ESLint and Lint and build are green on this head.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read scripts/npm-audit-gate.ts at df74571 end to end, not just the diff. This looks correct to me.

  • exceptionKey (scripts/npm-audit-gate.ts:131-133): pkg || "*" is applied on both sides — when the exception is inserted into active (L163) and when an advisory is looked up (L175-177) — so an exception with package: "" now lands on the same GHSA-…:* key the lookup falls back to. Before, ?? produced a dead GHSA-…: key that could never match an advisory (advisories always carry a non-empty package from collectAdvisories, L112), which is the #524 bug.
  • The unused-exception warning (L247-250) now includes ex.package || "*", so two entries for one GHSA scoped to different packages are distinguishable in the Actions annotation (#525).
  • Header docstring (L15-18) documents the field (#523).

Ran npx vitest run scripts/npm-audit-gate.test.ts at the PR head: 36/36 pass. The new treats an empty package as an unscoped exception test fails on main (the exception would be reported as unused and the advisory as blocking), so it pins the fix.

Open question, not a defect: the three Netlify checks (Header rules, Pages changed, Redirect rules, deploy-preview) are red on a PR that touches only scripts/ and changelog.d/. main has no Netlify check-runs I can compare against, and I cannot read the Netlify log from here. Probably a preview-build infrastructure issue rather than this diff, but someone with Netlify access should confirm before merging.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit 6a4fa59 into main Oct 30, 2026
6 of 10 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-523 branch October 30, 2026 04:38
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#526df74571` sha256:309177ebb42024fec489689623e09cae8b8dc13f601a8f09f7e770f4b4db2029 — download from the dashboard or `hivectl review evidence #526`.

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 30, 2026
hivecommons-hive Bot added a commit that referenced this pull request Oct 30, 2026
…te (#529)

#526 taught the gate to key exceptions by GHSA and package, and to print the
package (or * for an unscoped entry) in the unused-exception warning. Only the
scoped form of that warning was asserted, so the * fallback and the
scoped-entry-wins-wildcard-is-unused rule could both regress unnoticed.

Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off dco-signoff: yes size/S

Projects

None yet

0 participants