Skip to content

fix: draw nested boundaries inside their parent with ignoreUnused - #393

Open
G26karthik wants to merge 1 commit into
OWASP:masterfrom
G26karthik:fix-ignoreunused-nested-boundary
Open

G26karthik wants to merge 1 commit into
OWASP:masterfrom
G26karthik:fix-ignoreunused-nested-boundary

Conversation

@G26karthik

Copy link
Copy Markdown
Contributor

With ignoreUnused=True, a boundary nested in another boundary is drawn outside its parent in the DFD. For example, with dmz = Boundary("dmz", inBoundary=net) and a server in dmz, net is drawn as an empty cluster and dmz as a separate top-level cluster.

_get_elements_and_boundaries adds the source's and sink's boundary to boundaries and their parents to elements, but not the boundary itself. Boundary.dfd() finds its child clusters through TM._elements, so net never finds dmz. v1.3.1 added both boundaries (elements.add(e.source.inBoundary) and the same for the sink); they were lost in 1.4.0. This puts the two lines back, which also matches the default mode, where every boundary is in TM._elements.

The new test in tests/test_pytmfunc.py builds that model with ignoreUnused=True and checks that dmz's cluster is nested one level inside net's. It fails on master and passes with the change; tests/test_pytmfunc.py and tests/test_stale_paths.py otherwise give the same results as before (the four DFD comparison tests fail on Windows on master too, because of \ in the image paths).

I found no existing issue or PR for this.

With ignoreUnused=True, _get_elements_and_boundaries added the source's and sink's boundary to the boundaries set but not to the elements, so Boundary.dfd() never found a nested boundary and drew it at the top level. v1.3.1 added both; restore that.

This branch has not been deployed

No deployments
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.

1 participant