-
Notifications
You must be signed in to change notification settings - Fork 177
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
Introducing EmptyElement to avoid showing "invalid" elements on diagrams #232
base: master
Are you sure you want to change the base?
Conversation
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 like the commit, since it clarifies the intend.
pytm/pytm.py
Outdated
|
||
def __init__(self): | ||
super().__init__("AutoGenerated", description="Autogenerated element for Finding") | ||
self._is_drawn = True # Prevent drawing on a DFD diagram |
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.
This seems backwards. I have not checked yet, but if this is correct it should be refactored to represent the intention better.
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.
Added description
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.
Ahh after reading the code and your comment self._is_drawn
is an indicator to mark if the element has already been drawn.
I read it as "is it supposed to be drawn" . So I was just confused by the name.
But now I wonder if it is necessary as a member variable at all and if it could be moved into a drawing function. But this would require a mayor change I guess, since the drawing is split between all the dfd methods. I mean they are very similar and have duplicated code.
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 can exclude this element from drawing procedure using if clause (like if not isinstance(e, EmptyElement)
)...
Or introduce a variable and appropriate function/property like def is_visible()
Just tell me what is better to do in your opinion!
pytm/pytm.py
Outdated
@@ -1016,7 +1016,7 @@ def seq(self): | |||
participants.append( | |||
'database {0} as "{1}"'.format(e._uniq_name(), e.display_name()) | |||
) | |||
elif not isinstance(e, Dataflow) and not isinstance(e, Boundary): | |||
elif not any((isinstance(e, Dataflow), isinstance(e, Boundary), isinstance(e, EmptyElement))): |
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.
You can use isinstance with a tuple of types.
instance(e, (A,B,C))
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.
Fixed
3d063a3
to
64e13e1
Compare
Included this situation in tests |
- added EmptyElement - skipped generation EmptyElement on DFD and SEQ diagrams
64e13e1
to
9d36821
Compare
hey, thanks for the PR. I am a bit full this week but will be taking a look asap. |
Greetings! Sorry for disturbing, but how about this PR? |
sorry, still prioritizing work, but i have not forgotten this! |
Hey, thanks for working on this! I've tried a couple of workarounds, but I still have two problems (with 1.3.1), the element_invalid_ issue, and the text of my "response" member that I add to my Findings, not appearing in the report. I added a response field to my template like this:
but in the html, that item.response is empty, even though I supply a response="""To Mitigate: foo""", in my Finding(). One of the workarounds I thought I'd try for the invalid element issue, is to redirect the |
ho @oleh-mykytiuk will you be able to address @neilpvirtualitics comment or should i review/merge as is ? |
Hi! This is another issue. I saw the same. It can be overridden by using the property fundings.py
template.md:
I may open another PR to fix this. This PR should not affect other issues or problems. |
Hi @izar ! I replied ;) I think that this is another issue and should be fixed by another PR. |
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.
The more I look at it, the more "Empty" doesn't sit well with me. Can we think of a different name? An empty element, while empty, still "takes space". I really would prefer something that expresses the fact it is a dummy or filler, with no possible influence in the model.
Some ideas:
|
I like |
Null still gives a vibe of having a value. DummyElement ? That one is nothing more than a filler. |
My objections were about Overrides. And, I introduced this new Element type for this purpose. So, maybe |
In the issue #222 was mentioned creation of the spurious "invalid" elements. Also, in the PR #223 tried to override the name of auto-generated elements.
This PR goal is to skip using "invalid" elements on DFD and SEQ diagrams. Such elements can be a problem when a lot of Finding used for overriding findings (add additional information to the threats). This approach is mentioned in the official documentation (README file), but leads to problems on the diagrams.
What is done: