Repository navigation
fix(vis): list online audit findings so --exit-code and --fail-on trip - #255
Conversation
…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 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. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
Thank you for following the naming conventions! 🙏 |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Problem
In the online
vis auditpath,fetchVulnerabilitiesstores findings keyedname@version, but the audit handler read them by barename. An online audit printedN foundon the progress row while the result list stayed empty, so--exit-codeand--fail-oncould never trip.Fix
vis audit: look findings up byadvisoryKey(name, version)for both online and offline runs.vulnerabilitypolicy: 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 --securityhad the same wrong-key read and is fixed too. It has no test harness today, so that change is covered by review only.vis doctoronly counts the map's values, so it was never affected.PolicyInput.osvFindingsdoc comment updated.Tests
New
__tests__/commands/audit/audit-online-findings.test.tsruns the real handler against a real lock file with the OSVquerybatchendpoint stubbed through globalfetch(no new env variable, no shipped-code change for injection). It covers: finding listed, no finding,--severityfiltering,--exit-codenon-zero with a finding (JSON and default table format) and zero without one,--fail-onat and above the finding's severity. Four of these failed before the fix.Notes
native/is untouched. The Rust import fix from fix(vis): import the json module from its new home #252 is not included. I built only the NAPI addon (compiles without it) and ran no native parity tests, so native CI jobs may stay red until fix(vis): import the json module from its new home #252 merges.🤖 Generated with Claude Code