Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backend] Fix handling of platform_entity_files_ref config (#7406) #7417

Merged
merged 5 commits into from
Jun 20, 2024

Conversation

JeremyCloarec
Copy link
Contributor

@JeremyCloarec JeremyCloarec commented Jun 18, 2024

Proposed changes

  • Added fileId to external reference schema attributes
  • Fixed creation of external ref in createEntityRaw when platform_entity_files_ref is configured
  • Fixed updater for external ref deletion

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 filigran team use to identify PR from the Filigran team label Jun 18, 2024
@JeremyCloarec JeremyCloarec self-assigned this Jun 18, 2024
Copy link

codecov bot commented Jun 18, 2024

Codecov Report

Attention: Patch coverage is 18.18182% with 9 lines in your changes missing coverage. Please review.

Project coverage is 67.70%. Comparing base (cb75aec) to head (2b56b11).
Report is 8 commits behind head on master.

Files Patch % Lines
...latform/opencti-graphql/src/database/middleware.js 10.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7417      +/-   ##
==========================================
+ Coverage   67.59%   67.70%   +0.11%     
==========================================
  Files         561      561              
  Lines       69190    69258      +68     
  Branches     5880     5964      +84     
==========================================
+ Hits        46769    46894     +125     
+ Misses      22421    22364      -57     

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

@Archidoit
Copy link
Member

Creation works but we can't delete or remove the external ref from the entity.

  • Enforce external ref creation at file upload for Malwares
  • Create a malware with a file
  • An external reference associated with the file is well created and well associated to the malware
  • But you can't remove / delete the external ref from the malware

image

If you click on 'delete', the file is deleted but the external ref is still there :
image

If you try to delete again, error message :
image

@Kedae
Copy link
Member

Kedae commented Jun 19, 2024

Have you checked stixCoreObject@stixCoreObjectsImportPush ?

@JeremyCloarec
Copy link
Contributor Author

Yes, tested both entity creation and import push behavior. stixCoreObjectsImportPush was working properly once fileId was added back as an external ref attribute

@Archidoit
Copy link
Member

Archidoit commented Jun 20, 2024

We have only the choices 'update' or 'delete'.
image

We should also have 'remove', like it is proposed when we add the external ref after creation via the 'add' button :
image

What's more, when we click on 'delete', the external ref is from the object. But if you reload the external ref still apears (but without the file). And the external ref is still present (it has not been deleted from the platform) :
image

@Archidoit
Copy link
Member

Create an object with a file, an external reference with the file is created.

Go to an entity overview.
Click on 'add external reference' :
image

You can't select the external references created via the file upload (see test.txt in the list of the screenshot below) :
image

@Archidoit
Copy link
Member

Create an entity with a file. The external ref is well created.
Click on Update the external ref :
image

Change the source name. An error occurs for the URL field :
image

But the external ref is well updated if we leave the edition form :
image

@JeremyCloarec
Copy link
Contributor Author

URL validation problem has been moved to a separate issue: #7431

@JeremyCloarec
Copy link
Contributor Author

The questions about the expected behavior of these external references have been moved to this issue #7432

@JeremyCloarec JeremyCloarec merged commit 92cdff5 into master Jun 20, 2024
5 checks passed
@JeremyCloarec JeremyCloarec deleted the issue/7406 branch June 20, 2024 09:38
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.

3 participants