opencti icon indicating copy to clipboard operation
opencti copied to clipboard

[backend] Handle external refs files upload by import document (#7080)

Open SouadHadjiat opened this issue 1 year ago • 4 comments

Proposed changes

  • Include external reference files for document import
  • When uploading a file in external reference, get the entities (stix domain objects) linked to the external ref to be used for document import (importContextEntities). We list all entities, but in the vast majority of cases external refs are only linked to one entity. This will create a workbench on the context entity, with extracted objects linked to this entity.

Related issues

  • #7080

Checklist

  • [x] I consider the submitted work as finished
  • [x] 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

To test this PR, you need to run import-document and import-external-reference connectors locally. For import-external-reference, you will need to install wkhtmltopdf https://wkhtmltopdf.org/downloads.html and in config.yml set wkhtmltopdf_path: 'C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe'

When you test import-document, set your config with auto: true and validate_before_import: true, then make sure the workbench is created on the container of the external-ref.

image

SouadHadjiat avatar May 23 '24 07:05 SouadHadjiat

Codecov Report

Attention: Patch coverage is 91.11111% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 67.60%. Comparing base (c3c3c87) to head (4139d63).

Files Patch % Lines
...rm/opencti-graphql/src/domain/externalReference.js 42.85% 4 Missing :warning:
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7089   +/-   ##
=======================================
  Coverage   67.59%   67.60%           
=======================================
  Files         561      561           
  Lines       68760    68787   +27     
  Branches     5840     5844    +4     
=======================================
+ Hits        46480    46505   +25     
- Misses      22280    22282    +2     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 23 '24 08:05 codecov[bot]

PR ready to be reviewed

SouadHadjiat avatar May 27 '24 09:05 SouadHadjiat

master rebased for review

SouadHadjiat avatar May 30 '24 13:05 SouadHadjiat

Tested 👌

CelineSebe avatar May 31 '24 09:05 CelineSebe