fix(taxii-post): skip identity object when delete_created_by_ref is enabled (#6762)#6763
fix(taxii-post): skip identity object when delete_created_by_ref is enabled (#6762)#6763MohammadYusif wants to merge 1 commit into
Conversation
…nabled (OpenCTI-Platform#6762) When delete_created_by_ref is enabled, the connector strips created_by_ref from every object but still posted the author identity, which arrives as its own stream event. As a result the attribution the user asked to remove still reached the TAXII server. Extract the per-object transformation into _prepare_object, which now returns None for identity objects while delete_created_by_ref is enabled so they are not posted. All other objects are unchanged.
Contributor License AgreementHey @MohammadYusif! Thank you for your contribution to Filigran! Before we can merge this pull request, we need you to sign our Contributor License Agreement (CLA). Why do we need a CLA?The CLA helps protect both you and Filigran. It ensures that:
How to signYou can sign the CLA using either of these methods:
Once signed, this comment will be automatically updated. ❌ CLA not signed yet This is an automated message from the Filigran CLA Bot. If you have questions, please contact the maintainers. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR refactors STIX object transformation logic into a dedicated helper and adds unit tests to validate identity handling when delete_created_by_ref is enabled.
Changes:
- Extracted object transformation logic from
_process_messageinto a new_prepare_objectmethod. - Added behavior to skip posting
identityobjects whendelete_created_by_refis enabled. - Added unit tests and a small factory helper to build a connector with real config + mocked helper.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| stream/taxii-post/src/taxii_post_connector/connector.py | Introduces _prepare_object and switches _process_message to use it, including identity-skipping behavior. |
| stream/taxii-post/tests/test_connector.py | Adds tests for _prepare_object behavior and a helper to construct the connector with configuration overrides. |
| if self.config.stix_version != "2.1": | ||
| del data_object["extensions"] |
| data_object = data | ||
| if self.config.delete_created_by_ref and data_object.get("type") == "identity": | ||
| return None | ||
| data_object["spec_version"] = self.config.stix_version |
| self.helper.log_info( | ||
| "Skipping identity object " | ||
| + data["id"] | ||
| + " (delete_created_by_ref is enabled)" | ||
| ) |
|
Whilst your proposed solution would work for the specific case of skipping the identity objects attached to |
|
You're right, thanks for catching this. The underlying difficulty is that there's no reliable per-event way to distinguish an author identity from an intel identity: the connector sees one STIX object at a time, stream order isn't guaranteed, and there's no STIX flag (nor a usable Given that, I'd suggest decoupling the skip from Does that direction work, or would you rather drop the identity-skipping entirely and handle author suppression another way? Happy to rework the PR either way. |
Proposed changes
delete_created_by_refis enabled, the taxii-post stream connector strippedcreated_by_reffrom every object but still posted the author identity object (which arrives as its own stream event), so the attribution the user asked to remove still reached the TAXII server.stream/taxii-post/src/taxii_post_connector/connector.pyinto a new_prepare_objectmethod. It returnsNoneforidentityobjects whiledelete_created_by_refis enabled, so_process_messageskips posting them. All other objects keep the exact same transformation (marking refs / created_by_ref stripping, STIX version downgrade) and behaviour.Related issues
Checklist
Further comments
The identity object referenced by
created_by_refis exactly the author attribution thatdelete_created_by_refis meant to remove, so droppingidentityobjects under that flag is consistent with the configuration's intent. The skip is gated ondelete_created_by_refbeing enabled, so default behaviour for users who keep attribution is unchanged.Added three unit tests in
tests/test_connector.pycovering_prepare_object: identity skipped when the flag is on, identity kept when the flag is off, and non-identity objects still posted withcreated_by_refstripped. The full suite (26 tests) passes;black,isort --profile black, andflake8 --ignore=E,Ware clean.