-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution][Endpoint] changes to Endpoint metadata API in support of space awareness #193490
[Security Solution][Endpoint] changes to Endpoint metadata API in support of space awareness #193490
Conversation
…int-list-details-space-aware
…w SavedObjectsClientFactory
…int-list-details-space-aware
…nd add savedObject client factory
…simplify method call signatures
/ci |
…int-list-details-space-aware
/ci |
/ci |
…ils-space-aware' into task/olm-8538-endpoint-list-details-space-aware
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.
Cloud Security Posture changes LGTM 🚀
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.
D&R changes LGTM
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.
LGTM 👍 I liked how you simplified usage of EndpointMetadataService🥇
Left a few suggestions, but as usual leaving the decision up to you :)
Thanks!
registerListsServerExtension?: ListsServerExtensionRegistrar; | ||
licenseService: LicenseService; | ||
exceptionListsClient: ExceptionListClient | undefined; | ||
cases: CasesServerStart | undefined; | ||
featureUsageService: FeatureUsageService; | ||
experimentalFeatures: ExperimentalFeatures; | ||
messageSigningService: MessageSigningServiceInterface | undefined; | ||
/** An internal ES client */ | ||
esClient: ElasticsearchClient; |
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.
Can the name specify that it's an internal ES client?
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 rather keep it as is, since its consistent with how we normally name the ES client variables through out our code base. Is that cool with you?
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.
Sure 👍 thanks!
private getFleetAuthzService(): FleetStartContract['authz'] { | ||
if (!this.startDependencies?.fleetAuthzService) { | ||
if (!this.startDependencies?.fleetStartServices) { |
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.
should we also check for .authz
, or not necessary?
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.
Its not necessary
fleetServices = endpointContextStartContract.endpointFleetServicesFactory.asInternalUser(); | ||
fleetServices = mockedFleetServices.service.asInternalUser(); | ||
logger = loggingSystemMock.createLogger(); | ||
productFeatureService = createProductFeaturesServiceMock( |
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.
do you think we could refactor createProductFeaturesServiceMock
to accept an object, instead of multiple arguments where some of them are passed as undefined
?
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 ok either way... but perhaps if you feel we should, lets address it in a separate PR
productFeaturesService, | ||
} = this.startDependencies; | ||
const endpointMetadataService = this.getEndpointMetadataService(); | ||
const soClient = this.savedObjects.createInternalScopedSoClient(undefined, false); |
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.
what do you think about changing createInternalScopedSoClient
to accept an object, instead of undefined passing undefined to get a default value?
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.
yeah, I can do that. Will push through a change soon
@@ -41,35 +55,13 @@ export class EndpointFleetServicesFactory implements EndpointFleetServicesFactor | |||
return { | |||
agent: agentService.asInternalUser, | |||
agentPolicy, | |||
|
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.
was this on purpose? :)
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.
yeah, it was... more for readability in separating related services
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.
The code looks good! I didn’t spot any leftover logic with these changes. Thanks for addressing this!
…ils-space-aware' into task/olm-8538-endpoint-list-details-space-aware
…int-list-details-space-aware
…int-list-details-space-aware # Conflicts: # x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts # x-pack/plugins/security_solution/server/endpoint/mocks/mocks.ts # x-pack/plugins/security_solution/server/plugin.ts
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.
Fleet changes LGTM
💛 Build succeeded, but was flaky
Failed CI StepsTest FailuresMetrics [docs]Public APIs missing exports
Unknown metric groupsESLint disabled in files
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Starting backport for target branches: 8.x |
💔 All backports failed
Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…port of space awareness (elastic#193490) ## Summary ### Fleet Plugin - Added some mocks and updates others ### Security Solution The following refactoring changes were done in preparation for forthcoming work for supporting kibana spaces: - A new saved objects client factory service was introduced for use in `EndpointAppContextServices` - Deleted older saved objects client utilities - Simplified the list of options passed to `EndpointAppContextService#start()` method - Updated `EndpiontFleetServicesFactory` with: - simpler list of constructor arguments - changed members of object return by `asInternalUser()` - Refactored the `EndpintMetadataService` to: - take in simplified constructor arguments - Simplified most methods of the class with removal all ES Client, SO Client or Fleet services arguments from class method calling signatures. These are not provided to the service class upon initialization and can be accessed internally by the methods - Updates to Mocks and tests to reflect the above changes (cherry picked from commit 0b1e9f4) # Conflicts: # x-pack/plugins/security_solution/tsconfig.json
…in support of space awareness (#193490) (#194309) # Backport This will backport the following commits from `main` to `8.x`: - [[Security Solution][Endpoint] changes to Endpoint metadata API in support of space awareness (#193490)](#193490) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Paul Tavares","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-27T14:38:17Z","message":"[Security Solution][Endpoint] changes to Endpoint metadata API in support of space awareness (#193490)\n\n## Summary\r\n\r\n### Fleet Plugin\r\n\r\n- Added some mocks and updates others\r\n\r\n\r\n### Security Solution\r\n\r\nThe following refactoring changes were done in preparation for\r\nforthcoming work for supporting kibana spaces:\r\n\r\n- A new saved objects client factory service was introduced for use in\r\n`EndpointAppContextServices`\r\n- Deleted older saved objects client utilities\r\n- Simplified the list of options passed to\r\n`EndpointAppContextService#start()` method\r\n- Updated `EndpiontFleetServicesFactory` with:\r\n - simpler list of constructor arguments\r\n - changed members of object return by `asInternalUser()`\r\n- Refactored the `EndpintMetadataService` to:\r\n - take in simplified constructor arguments\r\n- Simplified most methods of the class with removal all ES Client, SO\r\nClient or Fleet services arguments from class method calling signatures.\r\nThese are not provided to the service class upon initialization and can\r\nbe accessed internally by the methods\r\n- Updates to Mocks and tests to reflect the above changes","sha":"0b1e9f475440d60260203ce2a85c8b57c4363130","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","Team:Defend Workflows","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services","apm:review","v8.16.0"],"number":193490,"url":"https://github.com/elastic/kibana/pull/193490","mergeCommit":{"message":"[Security Solution][Endpoint] changes to Endpoint metadata API in support of space awareness (#193490)\n\n## Summary\r\n\r\n### Fleet Plugin\r\n\r\n- Added some mocks and updates others\r\n\r\n\r\n### Security Solution\r\n\r\nThe following refactoring changes were done in preparation for\r\nforthcoming work for supporting kibana spaces:\r\n\r\n- A new saved objects client factory service was introduced for use in\r\n`EndpointAppContextServices`\r\n- Deleted older saved objects client utilities\r\n- Simplified the list of options passed to\r\n`EndpointAppContextService#start()` method\r\n- Updated `EndpiontFleetServicesFactory` with:\r\n - simpler list of constructor arguments\r\n - changed members of object return by `asInternalUser()`\r\n- Refactored the `EndpintMetadataService` to:\r\n - take in simplified constructor arguments\r\n- Simplified most methods of the class with removal all ES Client, SO\r\nClient or Fleet services arguments from class method calling signatures.\r\nThese are not provided to the service class upon initialization and can\r\nbe accessed internally by the methods\r\n- Updates to Mocks and tests to reflect the above changes","sha":"0b1e9f475440d60260203ce2a85c8b57c4363130"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193490","number":193490,"mergeCommit":{"message":"[Security Solution][Endpoint] changes to Endpoint metadata API in support of space awareness (#193490)\n\n## Summary\r\n\r\n### Fleet Plugin\r\n\r\n- Added some mocks and updates others\r\n\r\n\r\n### Security Solution\r\n\r\nThe following refactoring changes were done in preparation for\r\nforthcoming work for supporting kibana spaces:\r\n\r\n- A new saved objects client factory service was introduced for use in\r\n`EndpointAppContextServices`\r\n- Deleted older saved objects client utilities\r\n- Simplified the list of options passed to\r\n`EndpointAppContextService#start()` method\r\n- Updated `EndpiontFleetServicesFactory` with:\r\n - simpler list of constructor arguments\r\n - changed members of object return by `asInternalUser()`\r\n- Refactored the `EndpintMetadataService` to:\r\n - take in simplified constructor arguments\r\n- Simplified most methods of the class with removal all ES Client, SO\r\nClient or Fleet services arguments from class method calling signatures.\r\nThese are not provided to the service class upon initialization and can\r\nbe accessed internally by the methods\r\n- Updates to Mocks and tests to reflect the above changes","sha":"0b1e9f475440d60260203ce2a85c8b57c4363130"}},{"branch":"8.x","label":"v8.16.0","labelRegex":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
Summary
Fleet Plugin
Security Solution
The following refactoring changes were done in preparation for forthcoming work for supporting kibana spaces:
EndpointAppContextServices
EndpointAppContextService#start()
methodEndpiontFleetServicesFactory
with:asInternalUser()
EndpintMetadataService
to:Checklist