-
Notifications
You must be signed in to change notification settings - Fork 184
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
Conversation
@@ -1366,10 +1381,14 @@ def dfd(self, **kwargs): | |||
if levels and not levels & self.levels: | |||
return "" | |||
|
|||
color = self._color() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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?).
ready for re-review |
good catch. |
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? |
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. |
Added --colormap as a companion to --dfd: paints elements green/yellow/red according to the severity of their findings.