Skip to content

feat: support per-technique filtering of custom context menu items (#92)#805

Open
workmcg wants to merge 4 commits into
mitre-attack:developfrom
workmcg:context-menu-limit-techniques
Open

feat: support per-technique filtering of custom context menu items (#92)#805
workmcg wants to merge 4 commits into
mitre-attack:developfrom
workmcg:context-menu-limit-techniques

Conversation

@workmcg

@workmcg workmcg commented Jul 20, 2026

Copy link
Copy Markdown

Closes #92

What this does

Adds an optional limit_techniques filter to custom context menu items defined in assets/config.json. Today every custom context menu option is applied to every technique in a layer; this lets an option be scoped to specific techniques.

{
  "label": "foo",
  "url": "https://test.com",
  "limit_techniques": ["T1098", { "id": "T1059", "tactic": "execution" }]
}

Design note - multi-tactic techniques

@rjsmitre raised on the issue that for multi-tactic techniques we need a way to say whether an entry applies to all instances of the technique or only some.

Rather than invent new semantics, this follows the pattern the layer format already uses for exactly this ambiguity. Technique objects in a layer file take an optional tactic field, and the spec states that if the field is not present, the annotations apply under every tactic the technique belongs to.

limit_techniques mirrors that:

  • a bare ATT&CK ID ("T1059") applies to that technique under any tactic it appears in
  • an { id, tactic } pair scopes the entry to that technique under one tactic, with tactic in shortname/phase-name form, matching the layer format's tactic field
  • the two forms can be mixed in one list

This keeps the simple case simple and stays consistent with vocabulary contributors already know from layer files.

Backward compatibility

No breaking changes. limit_techniques is optional; when it is absent or an empty array, appliesTo() returns true and behaviour is identical to today - the item applies to every technique.

Changes

  • context-menu-item.ts - adds the ContextMenuTechniqueFilter type, stores limit_techniques, and adds appliesTo(technique, tactic)
  • context-menu-item.spec.ts - 7 unit tests covering: unset filter, empty filter, bare-ID match across tactics, bare-ID non-match, { id, tactic } scoped match, scoped non-match, and a mixed list
  • config parsing - reads limit_techniques from custom_context_menu_items
  • context menu rendering - filters items through applicableContextMenuItems
  • docs - documents the new field

Testing

npm test in nav-app. The new specs cover the filter semantics directly; existing specs confirm the default path is unchanged.

workmcg added 4 commits July 20, 2026 18:14
…k#92)

Documents the optional limit_techniques field on custom context menu items, per the approach proposed in issue mitre-attack#92.

Signed-off-by: Mukul Chauhan <work.mukul.chauhan@gmail.com>
Adds ContextMenuTechniqueFilter type and appliesTo() method, plus unit tests. Part of the limit_techniques proposal in issue mitre-attack#92.

Signed-off-by: Mukul Chauhan <work.mukul.chauhan@gmail.com>
Wires ContextMenuItem.appliesTo() into the context menu component/template so items respect limit_techniques for the technique/tactic being viewed.

Signed-off-by: Mukul Chauhan <work.mukul.chauhan@gmail.com>
Passes the optional limit_techniques field through to each ContextMenuItem when loading assets/config.json.

Signed-off-by: Mukul Chauhan <work.mukul.chauhan@gmail.com>
@workmcg
workmcg force-pushed the context-menu-limit-techniques branch from ac57cd0 to a660afe Compare July 20, 2026 12:50
@sonarqubecloud

Copy link
Copy Markdown

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