Skip to content

fix(misp): guard attribute label creation with convert_tag_to_label check (#6891)#6892

Merged
jabesq merged 1 commit into
masterfrom
fix/6891-misp-label-guard
Jul 6, 2026
Merged

fix(misp): guard attribute label creation with convert_tag_to_label check (#6891)#6892
jabesq merged 1 commit into
masterfrom
fix/6891-misp-label-guard

Conversation

@jabesq

@jabesq jabesq commented Jul 1, 2026

Copy link
Copy Markdown
Member

Proposed changes

  • Guard attribute-level tag → label conversion behind the convert_tag_to_label configuration flag in convert_attribute.py, so labels are only created when the option is explicitly enabled.
  • This aligns attribute tag handling with the existing behaviour elsewhere in the connector, where convert_tag_to_label is already checked before calling create_label.

Related issues

Checklist

  • I consider the submitted work as finished
  • I have signed my commits using GPG key.
  • I tested the code for its functionality using different use cases
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

Further comments

Bug: Attribute tags were being converted to labels unconditionally — even when convert_tag_to_label was set to false in the connector configuration. This caused unwanted labels to appear on imported STIX objects.

Root cause: The convert_attribute use-case was missing the self.config.convert_tag_to_label guard around the self.tag_converter.create_label(tag) call. Other code paths in the connector (e.g. event-level tag processing) already perform this check, so this was simply an oversight in the attribute-level path.

Fix: Wrap the create_label call and the subsequent attribute_labels.append inside an if self.config.convert_tag_to_label: block, making the behaviour consistent across the connector.

Copilot AI review requested due to automatic review settings July 1, 2026 15:55
@jabesq jabesq added the filigran team Item from the Filigran team. label Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

⚠️ Unused dependencies detected

The following packages appear to be unused:

  • pympler in external-import/misp/src/requirements.txt
  • urllib3 in external-import/misp/src/requirements.txt
  • pydantic-settings in external-import/misp/src/requirements.txt

How to fix: (1) if the package is used but under a different import name (e.g. PyYAMLyaml), add a mapping line to .github/deptry-package-map.txt. (2) if truly unused, remove it from the connector's requirements.txt.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a configuration mismatch in the MISP connector by ensuring attribute-level MISP tag → OpenCTI label creation respects the existing convert_tag_to_label (aka MISP_CREATE_TAGS_AS_LABELS) flag, aligning attribute handling with event-level behavior.

Changes:

  • Wrap attribute-level tag_converter.create_label(tag) usage behind if self.config.convert_tag_to_label:.
  • Prevent unintended label creation from attribute tags when the setting is disabled.

@jabesq jabesq merged commit 54d9884 into master Jul 6, 2026
24 of 25 checks passed
@jabesq jabesq deleted the fix/6891-misp-label-guard branch July 6, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team Item from the Filigran team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(misp): labels are created from tags even when convert_tag_to_label is set to false

3 participants