Repository navigation
Report dependency findings and malware in the scan summary - #213
juangaitanv wants to merge 3 commits into
Conversation
The scan and wait summary read only code issues, so a scan whose lockfiles pin malicious packages printed "0 findings in this scan" and an all-zero table. Only --fail-on malicious and the --out-format json report read the scan's dependency findings. ScanIssues::fetch now reads the dependency findings next to the code issues, once per run. The summary, the --fail-on malicious gate and the JSON report share that read. Before, the gate and the report each read them again when both flags were set. The summary counts dependency findings in every status, because the dependency endpoint does not report a status: - human: the findings line adds "N in dependencies", a "Malware:" line counts malicious packages, and a "Dependencies, any status" table splits malicious and vulnerable packages by severity. The by-status table is now titled "Code findings by status". - agent: dependency rows for malicious and vulnerable packages. - json: a dependencies object; total_findings includes them. A failed dependency read prints "dependencies not fetched" and the error, a dependency_error record, or dependencies.error with null counts. It never reads as zero. Findings with no severity count in the total as unrated, so a malicious package without a score still shows.
corgea-security
left a comment
There was a problem hiding this comment.
Automated review risk: 2/5.
Dependency findings are fetched once and shared across the summary, --fail-on malicious gate, and JSON report. Failed reads stay distinct from zero in the dependency section, and the new unit and e2e coverage matches that behavior. No critical or high defect is visible in the diff. Two non-blocking contract and copy issues are worth cleaning up.
No critical or high-priority changes were found.
corgea-security
left a comment
There was a problem hiding this comment.
Approved by Dennis: high policy risk and automated risk 2/5.
A failed dependency read made total_findings count code findings only, so a malware-only scan could read as clean. Bump the JSON schema_version to 2 for the changed total_findings meaning, and fix the unrated note's grammar.
|
Addressed the review in d0d5e62. When the dependency read fails, |
What changes
The summary that
corgea scanandcorgea waitprint at the end now includes the scan's dependency findings, and it calls out malicious packages:--format agentgainsdependencyrows for malicious and vulnerable packages.--format jsongains adependenciesobject. The table that was titled "All findings by status" is now "Code findings by status", because it still counts code findings only.Why
The summary read only code issues. A project whose lockfiles pin known malware printed
0 findingsand looked clean, while the scan page listed the malicious packages. We hit this with four test projects whose lockfiles pin OSVMAL-packages (for exampleflatmap-stream 0.1.1andrustdecimal 1.23.1). The server flagged all 9 pins as malicious, and every CLI summary said0 findings.Invariants
--fail-on maliciousgate and the--out-format jsonreport all use that read. Before, the gate and the report each fetched separately.dependencies not fetchedand the error, the agent format writes adependency_errorrecord, and the JSON setsdependencies.errorwithnullcounts. The code issues still print.--fail-onand--block-onexit codes don't change. The gate and the report still exit on a failed dependency read, as before.What can go wrong
scanandwaitnow pages through all dependency findings, 30 per page. A scan with thousands of dependency findings adds that many requests divided by 30. Not measured.unrated. It appears in the totals but in no severity column, so a malicious package with no severity still shows up.Compatibility
total_findingsin--format jsonnow includes dependency findings, andschema_versionstays 1. A consumer that expects code findings only will see a larger number.--fail-on malicious.Validation
The new e2e test in
tests/cloud_commands_e2e/scan_list.rs(malware shows with no gate) failed onmainwithremaining: ["read SCA issues"]and passes on this branch.Another e2e test fails if the run fetches dependency findings more than once (
unexpected extra request).corgea waitfor themalware-demo-node-shopscan, run in a terminal against a local stub API. The stub serves the scan's dependency findings: 3 malicious npm packages and 3 vulnerable ones. Same command and data,main(e8cf18c) vs this branch (cbd78b0):Before:
After:
Not run against a real instance. The stub's dependency response shape comes from doghouse's
_map_package_issue.