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

Added bold text to package and color to CVE only. #36

Closed
wants to merge 8 commits into from
Closed

Added bold text to package and color to CVE only. #36

wants to merge 8 commits into from

Conversation

joshuachp
Copy link
Contributor

Formatted the output like Package {pkg} is affected by {severity} {issues}. with the pkg in bold and the severity and issue colored.

@ilpianista
Copy link
Owner

I like the bold text, but I don't like to have the CVEs listed after the risk score. Mainly because you can have multiple CVEs affecting one package and the risk score isn't related to all of them, but to the riskier.

Attaching the "before-after" screenshot:
diff

@joshuachp
Copy link
Contributor Author

Then can I color each CVE by the respective severity and add the merged risk at the end, as it was before?

@ilpianista
Copy link
Owner

ilpianista commented Feb 10, 2020

Better yet, I think we don't need the risk score anymore if you colour each CVE differently.

Still, someone's terminal could not support colours, so we should display the risk score just in that case.

@joshuachp
Copy link
Contributor Author

I think the level is still useful. The severity is not so easy to understand from the color and I think it depends mainly on your terminal color scheme. It's also nice to have a summery of the CVEs severity.

@ilpianista
Copy link
Owner

Fine. Then just go ahead by coloring each cve respectively. Thanks!

@joshuachp
Copy link
Contributor Author

joshuachp commented Feb 12, 2020

I added a test to see how it should look with different CVEs. You can run it with cargo test -- --nocapture.

In the test the output could seem strange without the --nocapture because only the write!
and not the print! can be seen.

src/main.rs Outdated Show resolved Hide resolved
src/main.rs Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
@ilpianista
Copy link
Owner

There's something wrong. The package squid 4.8-2 has 3 vulnerabilities, in particular CVE-2019-18679 which has a Medium severity, but still it's coloured RED:

Screenshot-Rn6R2y

Also, when using --format, the commas are coloured.

@@ -145,23 +145,29 @@ fn main() {

/// Converts a JSON to an `avg::AVG`
fn to_avg(data: &Value) -> avg::AVG {
let severity = data["severity"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this is the reason behind the issue I was describing before.

Here, we set the CVE severity to the severity of the AVG. Which isn't the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see we don't have that information from the json. So the best option is to return to the start commit 04aa1f5 or close the pull request.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or print the AVG and color only that. But this is outside the scope of this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants