Skip to content

fix(importer): handle duplicate members in object groups#4384

Open
Y4nnikH wants to merge 5 commits into
CactuseSecurity:developfrom
Y4nnikH:fix/import-handle-duplicate-members
Open

fix(importer): handle duplicate members in object groups#4384
Y4nnikH wants to merge 5 commits into
CactuseSecurity:developfrom
Y4nnikH:fix/import-handle-duplicate-members

Conversation

@Y4nnikH

@Y4nnikH Y4nnikH commented Mar 11, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@Y4nnikH Y4nnikH self-assigned this Mar 11, 2026
Copilot AI review requested due to automatic review settings March 11, 2026 18:13

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 updates the importer’s group-member flattening and membership update logic to better handle duplicate members in object groups, primarily by deduplicating “flat” members and preventing duplicate group membership inserts.

Changes:

  • Change GroupFlatsMapper.get_*_flats() APIs to return set[...] (deduplicated) instead of list[...].
  • Update object/rule import paths to accommodate set-based flats (including deterministic iteration in one path).
  • Adjust unit tests to reflect set semantics and order-insensitive assertions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
roles/importer/files/importer/test/test_fwconfig_import_object.py Updates tests to use sets for flats and to avoid ordering assumptions in some assertions.
roles/importer/files/importer/services/group_flats_mapper.py Returns set from get_*_flats() to naturally deduplicate flattened members.
roles/importer/files/importer/model_controllers/fwconfig_import_rule.py Converts set-based flats back to lists for downstream rule-ref handling.
roles/importer/files/importer/model_controllers/fwconfig_import_object.py Uses set-based flats, enforces deterministic iteration for flat members, and deduplicates direct group-member inserts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread roles/importer/files/importer/test/test_fwconfig_import_object.py Outdated
Comment thread roles/importer/files/importer/model_controllers/fwconfig_import_rule.py Outdated
Comment thread roles/importer/files/importer/model_controllers/fwconfig_import_object.py Outdated
@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.

2 participants