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] Improve Crowdstrike executor #2760

Open
wants to merge 22 commits into
base: release/current
Choose a base branch
from
Open

Conversation

damgouj
Copy link
Member

@damgouj damgouj commented Mar 25, 2025

Proposed changes

  • Increase the Crowdstrike API limit
  • Save all the Crowdstrike agents in OpenBAS
  • Generate an asset group for each Crowdstrike host group

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
  • For bug fix -> I implemented a test that covers the bug

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...

Copy link

codecov bot commented Mar 25, 2025

Codecov Report

Attention: Patch coverage is 6.36943% with 147 lines in your changes missing coverage. Please review.

Project coverage is 40.18%. Comparing base (a504bc0) to head (42eca10).
Report is 1 commits behind head on release/current.

Files with missing lines Patch % Lines
.../main/java/io/openbas/service/EndpointService.java 0.00% 69 Missing ⚠️
.../crowdstrike/client/CrowdStrikeExecutorClient.java 0.00% 41 Missing ⚠️
...rowdstrike/service/CrowdStrikeExecutorService.java 11.76% 30 Missing ⚠️
...bas/executors/crowdstrike/CrowdStrikeExecutor.java 0.00% 2 Missing ⚠️
...src/main/java/io/openbas/service/AgentService.java 0.00% 2 Missing ⚠️
...ain/java/io/openbas/service/AssetGroupService.java 0.00% 2 Missing ⚠️
...src/main/java/io/openbas/service/AssetService.java 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@damgouj damgouj marked this pull request as ready for review March 25, 2025 10:16
List<CrowdStrikeDevice> devices = this.client.devices(hostGroup);
Optional<AssetGroup> existingAssetGroup =
assetGroupService.findByExternalReference(hostGroup);
CrowdStrikeHostGroup crowdStrikeHostGroup =
Copy link
Member

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.

renovate bot and others added 6 commits March 28, 2025 08:06
if (crowdStrikeResourceGroup.getErrors() != null
&& !crowdStrikeResourceGroup.getErrors().isEmpty()) {
CrowdstrikeError e = crowdStrikeResourceGroup.getErrors().getFirst();
log.log(
Copy link
Member

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);
Copy link
Member

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 ?

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
6 participants