-
Notifications
You must be signed in to change notification settings - Fork 946
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] observables values implemented (#8312) #8449
Conversation
99be3c5
to
9e337fe
Compare
b6a6246
to
0ca0d09
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/6.4.0 #8449 +/- ##
=================================================
- Coverage 66.14% 66.14% -0.01%
=================================================
Files 597 597
Lines 60500 60517 +17
Branches 6202 6210 +8
=================================================
+ Hits 40019 40030 +11
- Misses 20481 20487 +6 ☔ View full report in Codecov by Sentry. |
297b309
to
cb63e41
Compare
c0b3de1
to
8be7cd6
Compare
5a00ccd
to
32deebf
Compare
@@ -305,6 +312,18 @@ export const indicatorEditField = async (context: AuthContext, user: AuthUser, i | |||
if (!indicator) { | |||
throw FunctionalError('Cannot edit the field, Indicator cannot be found.'); | |||
} | |||
|
|||
const foundPattern = finalInput.find((item) => item.key === 'pattern'); | |||
if (!indicator.x_opencti_observables_values || foundPattern) { |
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.
could we extract this code block in a separate function? And maybe mutualize it with the same logic we have in addIndicator?
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.
I also suggest to move this part after the validation check about valid_until, since if we don't pass this validation check, there is no need for this part.
@@ -231,6 +233,10 @@ export const addIndicator = async (context: AuthContext, user: AuthUser, indicat | |||
// find default decay rule (even if decay is not activated, it is used to compute default validFrom and validUntil) | |||
const decayRule = await findDecayRuleForIndicator(context, observableType); | |||
const { validFrom, validUntil, revoked, validPeriod } = await computeValidPeriod(indicator, decayRule.decay_lifetime); | |||
const extractedObservableValues = getObservableValuesFromPattern(formattedPattern); | |||
if (!extractedObservableValues.length) { | |||
throw FunctionalError(`Indicator of type ${indicator.pattern_type} is not correctly formatted.`); |
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.
really ? do we always extract observable values from indicator pattern ? if we don't find observable values, we don't create the indicator ? extraction works only with stix pattern, what about other pattern types ?
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.
also I think it would be best to make sure we don't extract multiple times these observable values, like what we do in createObservablesFromIndicator.
c150d0f
to
264e053
Compare
2766155
to
bd26cea
Compare
bd26cea
to
1c40ec7
Compare
Proposed changes
Related issues
Related PR
Checklist
Further comments