Skip to content

[backend/client] handle file markings input as standard ids in file upload (#11643)#12666

Merged
JeremyCloarec merged 3 commits intomasterfrom
issue/11643
Feb 5, 2026
Merged

[backend/client] handle file markings input as standard ids in file upload (#11643)#12666
JeremyCloarec merged 3 commits intomasterfrom
issue/11643

Conversation

@JeremyCloarec
Copy link
Copy Markdown
Contributor

@JeremyCloarec JeremyCloarec commented Oct 8, 2025

Proposed changes

  • handle file markings input as standard ids in file upload
  • add file markings in all entities fragment in pycti to have it available during export
  • add file markings handling during export in opencti_stix2

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant uses case (coverage and e2e)
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

Further comments

@JeremyCloarec JeremyCloarec added the multi-repository For contribution that requires PR in several repository label Oct 8, 2025
@github-actions github-actions Bot added the filigran team use to identify PR from the Filigran team label Oct 8, 2025
@JeremyCloarec JeremyCloarec linked an issue Oct 8, 2025 that may be closed by this pull request
@JeremyCloarec JeremyCloarec marked this pull request as ready for review October 8, 2025 09:25
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 8, 2025

Codecov Report

❌ Patch coverage is 58.33333% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.10%. Comparing base (d715d2f) to head (81dc57e).
⚠️ Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
client-python/pycti/utils/opencti_stix2.py 0.00% 9 Missing ⚠️
...encti-platform/opencti-graphql/src/utils/access.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12666      +/-   ##
==========================================
+ Coverage   32.09%   32.10%   +0.01%     
==========================================
  Files        3006     3006              
  Lines      205955   205971      +16     
  Branches    37643    37656      +13     
==========================================
+ Hits        66092    66122      +30     
+ Misses     139863   139849      -14     
Flag Coverage Δ
opencti-client-python 45.27% <0.00%> (-0.04%) ⬇️
opencti-front 2.49% <ø> (+<0.01%) ⬆️
opencti-graphql 68.62% <93.33%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@xfournet xfournet removed the multi-repository For contribution that requires PR in several repository label Nov 13, 2025
@JeremyCloarec JeremyCloarec force-pushed the issue/11643 branch 3 times, most recently from f31fc38 to 1dd52c9 Compare December 11, 2025 15:32
@JeremyCloarec JeremyCloarec changed the title [backend] handle file markings input as standard ids in file upload (#11643) [backend/client] handle file markings input as standard ids in file upload (#11643) Dec 16, 2025
@JeremyCloarec JeremyCloarec requested a review from Copilot January 9, 2026 11:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 standardizes file marking handling to use internal IDs instead of standard IDs during file upload operations. The changes ensure that file markings are consistently stored as internal IDs in the backend, while also enabling proper marking export in the Python client by adding marking metadata to GraphQL queries and processing it in the STIX2 export logic.

  • Backend now normalizes file marking inputs to internal IDs before validation and storage
  • Python client GraphQL queries updated to include file marking metadata across all entity types
  • STIX2 export now properly constructs marking-definition objects for file markings

Reviewed changes

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

Show a summary per file
File Description
opencti-platform/opencti-graphql/src/database/file-storage.ts Normalizes file_markings input to internal IDs and passes markings cache to validation
opencti-platform/opencti-graphql/src/utils/access.ts Adds optional markingsMap parameter to validateMarking to avoid redundant cache lookups
opencti-platform/opencti-graphql/tests/03-integration/01-database/file-storage-test.js Updates test to verify file markings are stored as internal IDs
opencti-platform/opencti-graphql/tests/03-integration/01-database/file-storage-helper-test.ts Updates test expectations to compare against internal IDs
client-python/pycti/utils/opencti_stix2.py Adds logic to construct marking-definition objects from file markings during export
client-python/pycti/entities/*.py Adds objectMarking fragment to all entity GraphQL queries to fetch file marking metadata

Comment thread opencti-platform/opencti-graphql/src/database/file-storage.ts
Comment thread client-python/pycti/utils/opencti_stix2.py
Comment thread client-python/pycti/utils/opencti_stix2.py
Comment thread opencti-platform/opencti-graphql/src/database/file-storage.ts Outdated
Copy link
Copy Markdown
Member

@esrevi esrevi left a comment

Choose a reason for hiding this comment

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

tested on local, files have markings

Comment thread opencti-platform/opencti-graphql/src/database/file-storage.ts Outdated
@JeremyCloarec JeremyCloarec merged commit 4cceffe into master Feb 5, 2026
39 checks passed
@JeremyCloarec JeremyCloarec deleted the issue/11643 branch February 5, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team use to identify PR from the Filigran team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ExportFileStix] no marking on attachement (x_opencti_files)

5 participants