Repository navigation
fix(navlayers): expand subtechniques properly during SVG export - #255
Open
emrecoskunz wants to merge 1 commit into
Open
emrecoskunz wants to merge 1 commit into
emrecoskunz wants to merge 1 commit into
Conversation
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #169
Summary
Fixes subtechnique expansion during SVG export (
ToSvg/SvgTemplates) whereSVGConfig(showSubtechniques="all"),layout.expandedSubtechniques, and technique entries omittingenabledortacticfailed to render subtechniques in the exported SVG.Root Causes Fixed
enabledtreated as disabled (to_svg.py):Technique.enableddefaults toNone(UNSETVALUE) when omitted from a layer JSON.to_svg.pycheckedif not entry.enabled: continueinstead ofif entry.enabled is False: continue, skipping subtechnique expansion wheneverenabledwas not explicitly set totrue.svg_templates.py,svg_objects.py):to_svg.pyencodes tactic-less entries as(techniqueID, False), butSvgTemplates.get_tactic(),_copy_scores(), andSVG_Technique.build()checkedstr(id) + str(tactic)against concatenated strings (e.g."T1059False"), which never matched any tactic shortname. Matching now handlesentry[1] is False or entry[1] == tactic_shortnameconsistently withMatrixGen._construct_panop().showSubtechniques="all"andlayout.expandedSubtechniques(svg_templates.py,to_svg.py):SVGConfig(showSubtechniques="all")previously only iterated over techniques explicitly present inlayer.techniquesrather than expanding all non-disabled techniques in the matrix, andlayout.expandedSubtechniques("all"/"annotated") was ignored in"expanded"mode. Row-height counting inSvgTemplates.export()now uses the same expansion/exclusion logic asget_tactic()so expanded subtechniques scale cleanly.Validation
SVGConfig(showSubtechniques="all"), unsetenabled, missingtactic, and emptytechniquesall produced SVGs without subtechnique cells.tests/test_to_svg_subtechniques.py(6 tests covering"all","expanded","none", unsetenabled, omitted vs. scopedtactic,hideDisabled, andlayout.expandedSubtechniques"all"/"annotated").pytest tests/test_to_svg_subtechniques.py tests/test_layers.py -v-> 14 passed, 1 skipped (test_config_loadpre-existing skip)ruff checkandruff format --checkon all modified/added files -> 0 issues