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

Colormap #229

Merged
merged 7 commits into from
Feb 25, 2024
Merged

Colormap #229

merged 7 commits into from
Feb 25, 2024

Conversation

izar
Copy link
Collaborator

@izar izar commented Dec 18, 2023

Added --colormap as a companion to --dfd: paints elements green/yellow/red according to the severity of their findings.

@izar izar requested a review from colesmj December 18, 2023 18:01
@izar izar self-assigned this Dec 18, 2023
@@ -1366,10 +1381,14 @@ def dfd(self, **kwargs):
if levels and not levels & self.levels:
return ""

color = self._color()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this setting the color of the entire dfd, or of a specific Element?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

element

@@ -33,6 +33,17 @@
By Chris Beaumont
"""

def sev_to_color(sev):
Copy link
Collaborator

Choose a reason for hiding this comment

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

A general comment: How do you want to address setting the color for an Element when multiple Findings / Threats are associated with it where each has differing severities?

Also, when a Finding has a CVSS score, which translates to None, Low, Medium, High, Critical by the CVSS spec, can these be used instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

right now the final color of the element is the highest severity found among its findings, and right now i am ignoring the cvss score in favor of the severity hardcoded in the finding (from threats.json)

@@ -1352,6 +1370,7 @@
"protocol": "",
"response": null,
"responseTo": null,
"severity": 0,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you have any tests that used a non-zero severity? What about tests that tested the severity-setting logic on pytm.py:1498 (added)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did, but this specific one I think appears here because it is an element without a finding (so it defaults to 0)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please check - all severity in this file are 0. Please be sure to add non-zero severity tests (you are using severity to determine color, correct?).

@izar
Copy link
Collaborator Author

izar commented Dec 27, 2023

ready for re-review

@izar
Copy link
Collaborator Author

izar commented Jan 16, 2024

good catch.

@colesmj
Copy link
Collaborator

colesmj commented Jan 26, 2024

The output.json still shows only 0 severity outcomes. I see your test code should generate High severity, did the output file not get updated?

@izar
Copy link
Collaborator Author

izar commented Feb 1, 2024

The colormap testing is looking straight into the generated dot file, not on output.json - check dfd_colormap.dot, you'll see it has different colors compared with dfd.dot, those represent the severities.

@colesmj colesmj merged commit 4890300 into master Feb 25, 2024
4 checks passed
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.

3 participants