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]Verify createdBy type on malware creation (#6291) #6309

Merged
merged 7 commits into from Mar 13, 2024

Conversation

aHenryJard
Copy link
Member

@aHenryJard aHenryJard commented Mar 11, 2024

Proposed changes

  • Verify that the id given in createdBy relation is an Identity, if not throw exception and prevent from creating entity.
    • on creation
    • on update
    • on upsert
    • on relationAdd
  • Test are written using malware use case, but the implementation is for all entity that have createdBy relationship
  • Note that some changes in test (mainly '?' operator) are because of refactor of file from js to ts.

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
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@aHenryJard aHenryJard changed the title Verify createdBy type on malware creation (#6291) [backend]Verify createdBy type on malware creation (#6291) Mar 11, 2024
@aHenryJard aHenryJard marked this pull request as ready for review March 12, 2024 17:31
@aHenryJard aHenryJard added the filigran team use to identify PR from the Filigran team label Mar 13, 2024
@JeremyCloarec JeremyCloarec self-requested a review March 13, 2024 09:06
@@ -144,7 +145,7 @@ import {
isStixDomainObjectShareableContainer,
isStixObjectAliased,
resolveAliasesField,
STIX_ORGANIZATIONS_UNRESTRICTED,
STIX_ORGANIZATIONS_UNRESTRICTED
Copy link
Member

Choose a reason for hiding this comment

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

why do we have this change ? the last ',' should be kept

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's ESLint that did it, I can revert that

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand what's the convention for trailing commas in imports? There is already a mix of imports having a trailing comma on their last import line, and others not having it

Copy link

codecov bot commented Mar 13, 2024

Codecov Report

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

Project coverage is 67.27%. Comparing base (698b5a3) to head (dd46aa7).
Report is 6 commits behind head on master.

Files Patch % Lines
...orm/opencti-graphql/src/domain/stixDomainObject.js 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6309      +/-   ##
==========================================
+ Coverage   66.71%   67.27%   +0.56%     
==========================================
  Files         541      541              
  Lines       64501    64539      +38     
  Branches     5288     5594     +306     
==========================================
+ Hits        43033    43420     +387     
+ Misses      21468    21119     -349     

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

@aHenryJard aHenryJard merged commit 1a0ae19 into master Mar 13, 2024
8 checks passed
@SamuelHassine SamuelHassine deleted the issue/6291 branch April 3, 2024 10:57
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.

Creation of created-by relatiohship is not protected to target only identity
3 participants