Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimise human readable output for narrow terminals #85

Closed
idkw opened this issue Dec 19, 2022 · 6 comments · Fixed by #87 · May be fixed by #889
Closed

Optimise human readable output for narrow terminals #85

idkw opened this issue Dec 19, 2022 · 6 comments · Fixed by #87 · May be fixed by #889
Assignees
Labels
bug Something isn't working

Comments

@idkw
Copy link

idkw commented Dec 19, 2022

When using the default textual output and the SOURCE path is long enough, the output is truncated.

All lines end with a and are truncated which make the output unusable because it misses the OSV URL entirely.

╭────────────────────────────────────────────────────┬───────────┬─────────────────────────┬───────────────────────────────────┬───────────────────────────── ≈
│ SOURCE                                             │ ECOSYSTEM │ AFFECTED PACKAGE        │ VERSION                           │ OSV URL (ID IN BOLD)         ≈
├────────────────────────────────────────────────────┼───────────┼─────────────────────────┼───────────────────────────────────┼───────────────────────────── ≈
│ xxxxx/xxxxx/node_modules/package-lock.json         │ npm       │ lodash                  │ 4.17.4                            │ https://osv.dev/vulnerabilit ≈
│ xxxxx/xxxxx/node_modules/package-lock.json         │ npm       │ lodash                  │ 4.17.4                            │ https://osv.dev/vulnerabilit ≈
│ xxxxx/xxxxx/node_modules/package-lock.json         │ npm       │ lodash                  │ 4.17.4                            │ https://osv.dev/vulnerabilit ≈
│ xxxxx/xxxxx/node_modules/package-lock.json         │ npm       │ lodash                  │ 4.17.4                            │ https://osv.dev/vulnerabilit ≈
│ xxxxx/xxxxx/node_modules/package-lock.json         │ npm       │ lodash                  │ 4.17.4                            │ https://osv.dev/vulnerabilit ≈
│ xxxxx/xxxxx/node_modules/package-lock.json         │ npm       │ lodash                  │ 4.17.4                            │ https://osv.dev/vulnerabilit ≈
│ xxxxx/xxxxx/node_modules/package-lock.json         │ npm       │ lodash                  │ 4.17.4                            │ https://osv.dev/vulnerabilit ≈
│

I know about the JSON output, but I'd like to have an untruncated textual output too because it is more readable.

@idkw idkw changed the title Output is truncated Output is truncated when SOURCE path is too long Dec 19, 2022
@another-rex another-rex added the bug Something isn't working label Dec 19, 2022
@oliverchang
Copy link
Collaborator

oliverchang commented Dec 19, 2022

Re-opening as #87 was a partial fix/mitigation.

@oliverchang oliverchang reopened this Dec 19, 2022
@oliverchang
Copy link
Collaborator

Thanks for trying osv-scanner and opening this issue!

We've made some changes to mitigate this, and released https://github.com/google/osv-scanner/releases/tag/v1.0.2 which includes:

  • Moving the source column to be the last column
  • Better support for piping into less -S, which lets you horizontally scroll on narrow terminals.
  • Reducing the width of some column headers

Most of our team is out for the rest of the year, but once we're back early next year we'll work on improving this further!

@oliverchang oliverchang changed the title Output is truncated when SOURCE path is too long Optimise human readable output for narrow terminals Dec 20, 2022
@idkw
Copy link
Author

idkw commented Dec 20, 2022

Thanks !

@G-Rath
Copy link
Collaborator

G-Rath commented Dec 21, 2022

@oliverchang @another-rex this could be a good time to talk about supporting the output style of osv-detector as an alternative because that should be much better suited for narrow terminals:

Loaded the following OSV databases:
  Go (1003 vulnerabilities, including withdrawn - last updated Wed, 21 Dec 2022 18:22:46 GMT)

go.mod: found 8 packages
  Using config at .osv-detector.yaml (1 ignore)
  Using db Go (1003 vulnerabilities, including withdrawn - last updated Wed, 21 Dec 2022 18:22:46 GMT)

  golang.org/x/sys@0.0.0-20210630005230-0f9fa26af87c is affected by the following vulnerabilities:
    GO-2022-0493: When called with a non-zero flags parameter, the Faccessat function can...

  1 known vulnerability found in go.mod

what do you think?

@another-rex
Copy link
Collaborator

I do like how that looks, we can add a flag like e.g. --output-type=<table|text|json> for specifying what output type will be, though we still need to keep the --json flag for compatibility.

@oliverchang
Copy link
Collaborator

I believe there's no more remaining work here? (@another-rex please reopen if I'm wrong).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
5 participants