-
Notifications
You must be signed in to change notification settings - Fork 106
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] Improve Crowdstrike executor #2760
base: release/current
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/current #2760 +/- ##
=====================================================
- Coverage 40.41% 40.18% -0.24%
- Complexity 2068 2070 +2
=====================================================
Files 635 636 +1
Lines 19451 19589 +138
Branches 1325 1340 +15
=====================================================
+ Hits 7862 7871 +9
- Misses 11158 11287 +129
Partials 431 431 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
openbas-api/src/main/java/io/openbas/executors/crowdstrike/CrowdStrikeExecutor.java
Outdated
Show resolved
Hide resolved
...bas-api/src/main/java/io/openbas/executors/crowdstrike/client/CrowdStrikeExecutorClient.java
Outdated
Show resolved
Hide resolved
...bas-api/src/main/java/io/openbas/executors/crowdstrike/client/CrowdStrikeExecutorClient.java
Outdated
Show resolved
Hide resolved
...bas-api/src/main/java/io/openbas/executors/crowdstrike/client/CrowdStrikeExecutorClient.java
Outdated
Show resolved
Hide resolved
...s-api/src/main/java/io/openbas/executors/crowdstrike/service/CrowdStrikeExecutorService.java
Outdated
Show resolved
Hide resolved
…or (#2653) Co-authored-by: Yann <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Romuald Lemesle <[email protected]>
List<CrowdStrikeDevice> devices = this.client.devices(hostGroup); | ||
Optional<AssetGroup> existingAssetGroup = | ||
assetGroupService.findByExternalReference(hostGroup); | ||
CrowdStrikeHostGroup crowdStrikeHostGroup = |
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.
issue : Several things here - If there is an issue here (for instance, I just got a 403), this.client.hostGroup(hostGroup).getResources() will be null, leading to a NPE. Besides, we don't log anything even though CS sent us the error code and message. Last thing but let's say we had this issue and we raised an exception, we won't populate for the next host group.
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
7e5edeb
to
408f0bd
Compare
ded0569
to
7ec815e
Compare
if (crowdStrikeResourceGroup.getErrors() != null | ||
&& !crowdStrikeResourceGroup.getErrors().isEmpty()) { | ||
CrowdstrikeError e = crowdStrikeResourceGroup.getErrors().getFirst(); | ||
log.log( |
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'm gonna nitpick here but could you merge all the errors into the error message to not only show the first one ?
+ e.getMessage()); | ||
continue; | ||
} | ||
List<CrowdStrikeDevice> devices = this.client.devices(hostGroup); |
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.
Again, nitpicking here but could you add error handling here like you did above ?
Proposed changes
Related issues
Checklist
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...