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] validate elUpdateElement input value against schema before indexing (#5696) #6046
Conversation
5f46825
to
b19fd4a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6046 +/- ##
==========================================
+ Coverage 66.67% 66.71% +0.04%
==========================================
Files 541 541
Lines 64420 64501 +81
Branches 5256 5288 +32
==========================================
+ Hits 42950 43033 +83
+ Misses 21470 21468 -2 ☔ View full report in Codecov by Sentry. |
f13a150
to
93496ec
Compare
cdc32a6
to
6368e31
Compare
opencti-platform/opencti-graphql/src/schema/schema-attributes.ts
Outdated
Show resolved
Hide resolved
opencti-platform/opencti-graphql/tests/01-unit/database/validateDataBeforeIndexing-test.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using this (imo valid) input:
{
"id": "38fe587f-a73b-46ad-856f-cc2710246d42",
"input": {
"key": "user_confidence_level",
"object_path": "/user_confidence_level/overrides",
"value": [
{
"entity_type": "Administrative-Area",
"max_confidence": 60
},
{
"entity_type": "Country",
"max_confidence": 40
}
]
}
}
I have the following error:
{
"message": "Validation error",
"name": "VALIDATION_ERROR",
"time_thrown": "2024-02-26T13:56:35.665Z",
"data": {
"http_status": 500,
"genre": "BUSINESS",
"field": "user_confidence_level",
"message": "Attribute user_confidence_level cannot be multiple",
"data": {
"key": "user_confidence_level",
"object_path": "/user_confidence_level/overrides",
"value": [
{
"entity_type": "Administrative-Area",
"max_confidence": 60
},
{
"entity_type": "Country",
"max_confidence": 40
}
]
}
}
}
Like if the object_path
was not taking in account
This seems like a valid input yes. |
ea5aee0
to
15fcc65
Compare
I've pushed a commit to allow such case @lndrtrbn, and added some integration tests. |
opencti-platform/opencti-graphql/src/schema/schema-attributes.ts
Outdated
Show resolved
Hide resolved
2243e49
to
9384a8c
Compare
9384a8c
to
9513d34
Compare
ebcc492
to
2ba61b3
Compare
655453f
to
d793a45
Compare
This reverts commit 7088c20
4a958a2
to
7f3c259
Compare
Proposed changes
elUpdateElement
functionRelated issues