Skip to content

fix(vis): list online audit findings so --exit-code and --fail-on trip - #255

Merged
prisis merged 2 commits into
nextfrom
fix/audit-online-findings-lookup
Nov 25, 2026
Merged

prisis merged 2 commits into
nextfrom
fix/audit-online-findings-lookup

Conversation

@prisis

@prisis prisis commented Nov 25, 2026

Copy link
Copy Markdown
Member

Problem

In the online vis audit path, fetchVulnerabilities stores findings keyed name@version, but the audit handler read them by bare name. An online audit printed N found on the progress row while the result list stayed empty, so --exit-code and --fail-on could never trip.

Fix

  • vis audit: look findings up by advisoryKey(name, version) for both online and offline runs.
  • vulnerability policy: same key; the bare-name fallback is removed (no supplier is name-keyed any more) and its tests are re-keyed. A new test pins that a name-keyed map is ignored.
  • vis analyze --security had the same wrong-key read and is fixed too. It has no test harness today, so that change is covered by review only.
  • vis doctor only counts the map's values, so it was never affected.
  • Stale PolicyInput.osvFindings doc comment updated.

Tests

New __tests__/commands/audit/audit-online-findings.test.ts runs the real handler against a real lock file with the OSV querybatch endpoint stubbed through global fetch (no new env variable, no shipped-code change for injection). It covers: finding listed, no finding, --severity filtering, --exit-code non-zero with a finding (JSON and default table format) and zero without one, --fail-on at and above the finding's severity. Four of these failed before the fix.

Notes

🤖 Generated with Claude Code

…on trip

The online OSV catalog stores findings keyed `name@version`, but the audit
handler looked them up by bare package name. An online audit therefore
printed "N found" on the progress row while the result list stayed empty,
and neither --exit-code nor --fail-on could ever fire.

Look findings up by `name@version` in the audit handler, in the vulnerability
policy (dropping its bare-name fallback) and in `vis analyze --security`.
Add an end-to-end test for the online path with the OSV querybatch endpoint
stubbed through `fetch`: listing, --severity filtering, --exit-code and
--fail-on.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo did not review this PR because this workspace reached its daily trial limit of 100 reviews. Reviews start again at 00:00 UTC. Choose a plan to continue now.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 23cfb287-9a5d-447f-9234-2006b15e57b5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot added size:S Size of the change, tests and generated files excluded. package: vis labels Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@github-actions github-actions Bot added the vouch:trusted PR author is a collaborator, a bot or on the VOUCHED list. label Nov 25, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@prisis
prisis merged commit 91e8f92 into next Nov 25, 2026
16 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: vis size:S Size of the change, tests and generated files excluded. vouch:trusted PR author is a collaborator, a bot or on the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant