[go: nahoru, domu]

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] Change external reference resolution for OpenBAS integration #7233

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[backend] Change URI
  • Loading branch information
RomuDeuxfois committed Jun 6, 2024
commit 1e12f6a6017593798b55ad164306930bc8e1e4c5
2 changes: 1 addition & 1 deletion opencti-platform/opencti-graphql/src/database/xtm-obas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@
}
const httpClient = buildXTmOpenBasHttpClient();
try {
const { data: exercise } = await httpClient.get(`/scenarios/external_reference/${id}`);
const { data: exercise } = await httpClient.get(`/opencti/v1/exercises/latest/${id}`);
if (!exercise || !exercise.exercise_id) {

Check warning on line 179 in opencti-platform/opencti-graphql/src/database/xtm-obas.ts

View check run for this annotation

Codecov / codecov/patch

opencti-platform/opencti-graphql/src/database/xtm-obas.ts#L178-L179

Added lines #L178 - L179 were not covered by tests
return noResult;
}
const prevention = exercise.exercise_global_score.filter((n: { type: string, value: number }) => n.type === 'PREVENTION').at(0);

Check warning on line 182 in opencti-platform/opencti-graphql/src/database/xtm-obas.ts

View check run for this annotation

Codecov / codecov/patch

opencti-platform/opencti-graphql/src/database/xtm-obas.ts#L182

Added line #L182 was not covered by tests
const preventionResult = prevention.avgResult === 'UNKNOWN' ? {
unknown: 1,
success: 0,
Expand All @@ -189,7 +189,7 @@
success: prevention.distribution?.filter((n: { label: string, value: number }) => n.label === 'Successful').at(0).value,
failure: prevention.distribution?.filter((n: { label: string, value: number }) => n.label === 'Failed').at(0).value
};
const detection = exercise.exercise_global_score.filter((n: { type: string, value: number }) => n.type === 'DETECTION').at(0);

Check warning on line 192 in opencti-platform/opencti-graphql/src/database/xtm-obas.ts

View check run for this annotation

Codecov / codecov/patch

opencti-platform/opencti-graphql/src/database/xtm-obas.ts#L192

Added line #L192 was not covered by tests
const detectionResult = detection.avgResult === 'UNKNOWN' ? {
unknown: 1,
success: 0,
Expand All @@ -199,7 +199,7 @@
success: detection.distribution?.filter((n: { label: string, value: number }) => n.label === 'Successful').at(0).value,
failure: detection.distribution?.filter((n: { label: string, value: number }) => n.label === 'Failed').at(0).value
};
const humanResponse = exercise.exercise_global_score.filter((n: { type: string, value: number }) => n.type === 'HUMAN_RESPONSE').at(0);

Check warning on line 202 in opencti-platform/opencti-graphql/src/database/xtm-obas.ts

View check run for this annotation

Codecov / codecov/patch

opencti-platform/opencti-graphql/src/database/xtm-obas.ts#L202

Added line #L202 was not covered by tests
const humanResponseResult = humanResponse.avgResult === 'UNKNOWN' ? {
unknown: 1,
success: 0,
Expand Down