[backend] feat(stix): artifact management (#3511)#4950
Conversation
13aa423 to
bac9d61
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release/current #4950 +/- ##
=====================================================
+ Coverage 58.04% 58.38% +0.33%
- Complexity 4891 4932 +41
=====================================================
Files 1022 1023 +1
Lines 31107 31342 +235
Branches 2331 2353 +22
=====================================================
+ Hits 18057 18299 +242
+ Misses 12030 12001 -29
- Partials 1020 1042 +22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3c1119c to
191a1cd
Compare
8e3f76e to
67b8126
Compare
There was a problem hiding this comment.
Pull request overview
This pull request adds artifact management functionality to OpenAEV's STIX bundle processing system. When threat actors are referenced with artifacts (executable files or other attachments) in OpenCTI reports, these files can now be imported as FileDrop payloads in OpenAEV scenarios. The implementation includes automatic file download from OpenCTI, document creation, FileDrop payload generation, and inject creation for each injector contract supporting file drops.
Changes:
- Extended STIX parsing to support artifact objects and extract file metadata (URI, name, mime_type)
- Implemented file download and document upsert functionality with OpenCTI integration
- Added database migration to change StixRefToExternalRef from single external_ref to list of external_refs
- Created inject management for file drop payloads based on artifacts in security coverage
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| openaev-model/.../ObjectFactory.java | Registered ARTIFACT object type in STIX object factory |
| openaev-model/.../ObjectTypes.java | Added ARTIFACT enum value for STIX object types |
| openaev-model/.../CommonProperties.java | Added URI and MIME_TYPE properties for artifact metadata |
| openaev-model/.../PayloadRepository.java | Added query to find FileDrop by document ID |
| openaev-model/.../InjectRepository.java | Added delete query for injects with FileDrop contracts |
| openaev-model/.../DocumentRepository.java | Added query to find documents linked to scenario injects |
| openaev-model/.../StixRefToExternalRef.java | Changed from single external_ref to list of external_refs |
| openaev-model/.../SecurityCoverage.java | Added artifactsRefs field for artifact references |
| openaev-api/.../SecurityCoverageUtils.java | Converted to Spring component, added artifact processing logic |
| openaev-api/.../StixService.java | Minor refactoring to remove redundant variable |
| openaev-api/.../SecurityCoverageService.java | Integrated artifact coverage processing and reporting |
| openaev-api/.../SecurityCoverageInjectService.java | Implemented inject creation/deletion for artifacts |
| openaev-api/.../PayloadService.java | Added FileDrop payload creation from documents |
| openaev-api/.../DocumentService.java | Added upsert method for document creation/update |
| openaev-api/.../DocumentApi.java | Refactored to use DocumentService.upsert |
| openaev-api/.../AttackPatternService.java | Updated to use SecurityCoverageUtils component |
| openaev-api/.../OpenCTIService.java | Added file download and document creation functionality |
| openaev-api/.../OpenCTIConfig.java | Added getFormattedUrl helper method |
| openaev-api/.../OpenCTIClient.java | Implemented HTTP download method |
| openaev-api/.../File.java | New response model for file downloads |
| openaev-api/.../V4_73__Add_artifacts_column_to_security_coverage.java | Database migration for artifacts and external_refs refactoring |
| openaev-api/test/.../SecurityCoverageFixture.java | Updated fixture to use List for external refs |
| openaev-api/test/.../SecurityCoverageServiceTest.java | Updated tests for external_refs list |
| openaev-api/test/.../DocumentApiTest.java | Added tests for document upsert functionality |
| openaev-api/test/.../StixApiTest.java | Added tests for artifact processing with mock server |
| openaev-api/test/resources/stix-bundles/*.json | Added test STIX bundles with artifacts |
| openaev-api/test/resources/stix-bundles/artifact-file-test.txt | Test artifact file content |
474159c to
1f40619
Compare
|
Tests: OK
|
1f40619 to
f5f608d
Compare
Proposed changes
Testing Instructions
Related issues
Checklist