Skip to content

Commit

Permalink
feat: add "vertical" output format (#889)
Browse files Browse the repository at this point in the history
This adds a new "vertical" output format that is designed for humans and
based on the output of `osv-detector`, which effectively aims to group
the output relating to each entity being scanned in vertical slices:

<img width="898" alt="image"
src="https://github.com/google/osv-scanner/assets/3151613/61297153-5c22-43a4-a78e-e07ce648142a">

Unfortunately I think it suffers significantly due to the assumptions
made by the rest of the codebase for outputting that made sense when the
final output was a table i.e. we dump a lot of information as we go
about scanning, config files, vulnerability filtering, and so on that
really should be grouped but currently cannot because they're all
outputted at different stages - I think a way to address that could be
using some sort of event-emitter type pattern so that the reporters
could be responsible for deciding what they actually do (e.g.
`r.Emit("filtered-vulnerability", ...)` and then most reporters could
choose to just print immediately, and ones like "vertical" could choose
to add it to an internal struct), but I think that'll involve a lot more
work; for now I'm just going to ignore the pre-results output.

Resolves #85
  • Loading branch information
G-Rath authored Jul 26, 2024
1 parent f3aabe4 commit 42514fc
Show file tree
Hide file tree
Showing 7 changed files with 1,085 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/osv-scanner/__snapshots__/main_test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Scanned <rootdir>/fixtures/locks-many/package-lock.json file and found 1 package
---

[TestRun/#06 - 2]
unsupported output format "unknown" - must be one of: table, json, markdown, sarif, gh-annotations, cyclonedx-1-4, cyclonedx-1-5
unsupported output format "unknown" - must be one of: table, vertical, json, markdown, sarif, gh-annotations, cyclonedx-1-4, cyclonedx-1-5

---

Expand Down
Loading

0 comments on commit 42514fc

Please sign in to comment.