-
Notifications
You must be signed in to change notification settings - Fork 183
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
Expose Actor and Asset lists in report template #150
Conversation
If we want to proceed with this approach I can do the same for Actors in this PR, otherwise I can revert and just filter elements in the report method. |
DeepCode failed to analyze this pull requestSomething went wrong despite trying multiple times, sorry about that. |
@@ -869,6 +871,7 @@ def report(self, template_path): | |||
"threats": TM._threats, | |||
"findings": self.findings, | |||
"elements": TM._elements, |
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.
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 don't have a strong opinion either way as for the existence of _elements in the code. Obviously I agree with using assets since I raised the PR : ) I would probably go a step further and remove elements from json output and as mentioned add an Actor list so that objects are only referenced once. You could hold off on that for a major version to avoid breaking changes or do so now but add a bool flag on TM to remove elements and maintain existing functionality.
I updated the PR with a similar change for Actors so its ready to merge if desired. |
I was trying to use the report framework to mimc existing TM output where annotations for components (Assets in pytm) are separate from dataflows. I couldn't do this currently as Assets were only included in Elements so I replicated what was done for boundaries, flows and elements for assets.
Everything works locally in my manual tests, also updated json test data to reflect inclusion of the asset list and confirm all tests now pass.
One difference here is that the other TM._lists are actually used in the code for logic purposes, boundaries, flows, elements are looped thru in various points to process the TM. Currently this not needed for Assets but seems reasonable there may be a use case in the future.
I implemented the same for Actors.
Alternatively if we don't want to include additional TM._lists the report issue could be addressed by filtering elements in the TM.report method.
`assets = [ obj for obj in TM._elements if not isinstance(obj, Asset) ]
`