-
Notifications
You must be signed in to change notification settings - Fork 172
[backend] feat(executors): adapt Tanium and improve all executors - chunk 2 (#3515) #4491
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
base: release/current
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release/current #4491 +/- ##
=====================================================
+ Coverage 50.39% 50.84% +0.45%
- Complexity 3721 3752 +31
=====================================================
Files 912 913 +1
Lines 27301 27371 +70
Branches 2046 2057 +11
=====================================================
+ Hits 13758 13917 +159
+ Misses 12707 12606 -101
- Partials 836 848 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| + UUID.randomUUID() | ||
| + "\";md $location -ea 0;[Environment]::CurrentDirectory"; | ||
| Endpoint.PLATFORM_TYPE platform = Endpoint.PLATFORM_TYPE.Windows; | ||
| Endpoint.PLATFORM_TYPE platform = Windows; |
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.
nitpick : Happy to discuss about it as it's clearly a nitpicky nitpick but I feel it's easier to read when you write PLATFORM_TYPE.Windows. It makes it clearer that it's an enum.
| this.taskScheduler.scheduleAtFixedRate(service, Duration.ofHours(6)); | ||
| new SentinelOneGarbageCollectorService( | ||
| this.config, this.sentinelOneExecutorContextService, this.agentService); | ||
| this.taskScheduler.scheduleAtFixedRate(service, Duration.ofHours(8)); |
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.
Suggestion : Maybe we should make the rate configurable in the properties
| this.taskScheduler.scheduleAtFixedRate(service, Duration.ofHours(6)); | ||
| new TaniumGarbageCollectorService( | ||
| this.config, this.taniumExecutorContextService, this.agentService); | ||
| this.taskScheduler.scheduleAtFixedRate(service, Duration.ofHours(8)); |
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.
Suggestion : Maybe we should make the rate configurable in the properties
| this.taskScheduler.scheduleAtFixedRate(service, Duration.ofHours(6)); | ||
| new CrowdStrikeGarbageCollectorService( | ||
| this.config, this.crowdStrikeExecutorContextService, this.agentService); | ||
| this.taskScheduler.scheduleAtFixedRate(service, Duration.ofHours(8)); |
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.
Suggestion : Maybe we should make the rate configurable in the properties
| } | ||
| } | ||
| } | ||
| """, |
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.
nitpick : Maybe this should be a final class member
| try { | ||
| String query = | ||
| String.format( | ||
| """ |
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.
Suggestion : Maybe use a final class member
|
|
||
| if (!this.taniumExecutorConfig.isEnable()) { | ||
| throw new AgentException("Fatal error: Tanium executor is not enabled", agent); | ||
| throw new RuntimeException("Fatal error: Tanium executor is not enabled"); |
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.
chore : We should move away from using generic RuntimeException and create more specific exceptions. Maybe an ExecutorException ?
| crowdStrikeExecutorContextService.launchBatchExecutorSubprocess( | ||
| inject, new HashSet<>(agents), injectStatus); | ||
| // Executor scheduled so we have to wait before the execution | ||
| Thread.sleep(1000); |
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.
Suggestion : Maybe a lib like Awaitibility would be better ? With Thread.sleep, you're blocking the whole thread for no real reasons
| sentinelOneExecutorContextService.launchBatchExecutorSubprocess( | ||
| inject, new HashSet<>(agents), injectStatus); | ||
| // Executor scheduled so we have to wait before the execution | ||
| Thread.sleep(1000); |
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.
Suggestion : Maybe a lib like Awaitibility would be better ? With Thread.sleep, you're blocking the whole thread for no real reasons
| taniumExecutorContextService.launchBatchExecutorSubprocess( | ||
| inject, new HashSet<>(agents), injectStatus); | ||
| // Executor scheduled so we have to wait before the execution | ||
| Thread.sleep(1000); |
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.
Suggestion : Maybe a lib like Awaitibility would be better ? With Thread.sleep, you're blocking the whole thread for no real reasons
a115640 to
969eb2e
Compare
Proposed changes
Testing Instructions
Related issues
Checklist