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

[Security Solution] Add searchDeepLinks to security solution #89772

Merged

Conversation

kqualters-elastic
Copy link
Contributor

@kqualters-elastic kqualters-elastic commented Jan 29, 2021

Summary

This pr adds searchDeepLinks for each of the subPlugins in the SIEM app, and updates them as appropriate when license levels change. All parts of the SIEM app that have their own route are included, however detection tabs are not, as the activeTab is managed in application state instead of url state. Closes #86167.
license_switch

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@kqualters-elastic kqualters-elastic added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team v7.12.0 labels Feb 17, 2021
@kqualters-elastic kqualters-elastic marked this pull request as ready for review February 17, 2021 22:02
@kqualters-elastic kqualters-elastic requested a review from a team as a code owner February 17, 2021 22:02
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

it('returns a subset of links for basic license, full set for platinum', () => {
const basicLicense = 'basic';
const platinumLicense = 'platinum';
for (const pageName of Object.values(SecurityPageName)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might been a good fit for describe.each or it.each. See https://jestjs.io/docs/en/api#describeeachtablename-fn-timeout

For now, perhaps add expect.assertions as described here: https://jestjs.io/docs/en/expect#expectassertionsnumber

},
],
// The tabs in the detections subPlugin are not their own route as they are in other subplugins. If they were, add metadata here to enable search.
// premium: [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing this dead code.

import { SecuritySubPluginNames, SecurityDeepLinks } from '../types';
import { AppMeta } from '../../../../../../src/core/public';

const securityDeepLinks: SecurityDeepLinks = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the paths used for the pages are changed, and these configurations aren't changed, that would introduce a bug. Perhaps you could write a functional test to prove that this works. The test could search for the pages in the global search bar and click the results (and verify that the expected page shows up.)

If nothing else, it would be good to add a similar test to a manual test plan.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree. Will add a functional test later.

@@ -73,6 +75,9 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
constructor(initializerContext: PluginInitializerContext) {
this.kibanaVersion = initializerContext.env.packageInfo.version;
}
private detectionsUpdater$ = new BehaviorSubject<AppUpdater>(() => ({}));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you explain this (in a comment perhaps?) Why do these BehaviorSubject's take such functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's an initial value, not needed in this case, so changing to just Subject

@@ -356,7 +365,21 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
});
}
licenseService.start(plugins.licensing.license$);

const licensing = licenseService.getLicenseInformation$();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you add a short comment here describing what this code does?

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 2208 2209 +1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
securitySolution 237.4KB 242.6KB +5.2KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@kqualters-elastic kqualters-elastic merged commit 2b0481c into elastic:master Feb 18, 2021
@kqualters-elastic kqualters-elastic deleted the siem-add-search-providers branch February 18, 2021 01:59
kqualters-elastic added a commit to kqualters-elastic/kibana that referenced this pull request Feb 18, 2021
…#89772)

* WIP add search for siem entities

* Remove frontend search provider, use searchDeepLinks from core

* Comment and use both functions used to generate subPlugin meta information

* Use correct url for timeline templates

* Remove case management attibute from saved object type

* Remove unused globalSearch plugin from kibana.json

* Add comments, use Subject instead of BehaviorSubject for appUpdaters

* Unsubscribe from license on plugin stop
kqualters-elastic added a commit that referenced this pull request Feb 18, 2021
…#91788)

* WIP add search for siem entities

* Remove frontend search provider, use searchDeepLinks from core

* Comment and use both functions used to generate subPlugin meta information

* Use correct url for timeline templates

* Remove case management attibute from saved object type

* Remove unused globalSearch plugin from kibana.json

* Add comments, use Subject instead of BehaviorSubject for appUpdaters

* Unsubscribe from license on plugin stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team v7.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[GS] Add Security Solution deep links to navigational search
5 participants