Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0f12cd9
hide security solution pages
tomsonpl Apr 24, 2025
5ca23ba
investigations
tomsonpl Apr 24, 2025
1c3e040
fix notes
tomsonpl Apr 24, 2025
311b2c3
fix notes v2
tomsonpl Apr 24, 2025
a3dfac8
Merge branch 'main' into ai-soc-dashboards
tomsonpl Apr 24, 2025
77789c0
Merge branch 'main' into ai-soc-dashboards
ashokaditya Apr 25, 2025
fa49b26
fix explore routes
ashokaditya Apr 28, 2025
1907e11
fix CSP page route
ashokaditya Apr 28, 2025
6f90244
Merge branch 'main' into ai-soc-dashboards
ashokaditya Apr 29, 2025
2fb226b
Merge branch 'main' into ai-soc-dashboards
ashokaditya Apr 29, 2025
c90bf41
review changes
ashokaditya Apr 29, 2025
d51e2a7
tests for visible pages
ashokaditya Apr 30, 2025
fe78147
tests for page redirects
ashokaditya Apr 30, 2025
10bd1ed
add tests for pages that are not redirected
ashokaditya Apr 30, 2025
e4bba6c
Merge branch 'main' into ai-soc-dashboards
ashokaditya Apr 30, 2025
2455321
fix detection rules breadcrumb
ashokaditya Apr 30, 2025
cf70e81
fix
ashokaditya Apr 30, 2025
fe377a0
Merge branch 'main' into ai-soc-dashboards
ashokaditya Apr 30, 2025
9bd7656
Merge branch 'main' into ai-soc-dashboards
ashokaditya May 1, 2025
041e97f
tests for access denied callout for ML links
ashokaditya May 2, 2025
2703cdb
Merge branch 'main' into ai-soc-dashboards
ashokaditya May 5, 2025
15f7c60
review changes for tests
ashokaditya May 5, 2025
82ba336
Merge branch 'main' into ai-soc-dashboards
ashokaditya May 5, 2025
cbd965f
Merge branch 'main' into ai-soc-dashboards
ashokaditya May 5, 2025
e32b406
Merge branch 'main' into ai-soc-dashboards
ashokaditya May 5, 2025
b5b72b3
fix type check
ashokaditya May 5, 2025
790e425
Merge branch 'main' into ai-soc-dashboards
ashokaditya May 6, 2025
4f88971
Merge branch 'main' into ai-soc-dashboards
ashokaditya May 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export const RULES_LANDING_PATH = `${RULES_PATH}/landing` as const;
export const RULES_ADD_PATH = `${RULES_PATH}/add_rules` as const;
export const RULES_UPDATES = `${RULES_PATH}/updates` as const;
export const RULES_CREATE_PATH = `${RULES_PATH}/create` as const;
export const RULES_MANAGEMENT_PATH = `${RULES_PATH}/management` as const;
export const EXCEPTIONS_PATH = '/exceptions' as const;
export const EXCEPTION_LIST_DETAIL_PATH = `${EXCEPTIONS_PATH}/details/:detailName` as const;
export const HOSTS_PATH = '/hosts' as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
import type { LinkItem } from '../common/links/types';

export const links: LinkItem = {
capabilities: [`${SECURITY_FEATURE_ID}.show`],
capabilities: [[`${SECURITY_FEATURE_ID}.show`, `${SECURITY_FEATURE_ID}.detections`]],
globalNavPosition: 11,
globalSearchKeywords: [
i18n.translate('xpack.securitySolution.appLinks.inventory', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { SecurityPageName } from '../app/types';
import { ASSET_INVENTORY_PATH } from '../../common/constants';
import { SecuritySolutionPageWrapper } from '../common/components/page_wrapper';
import { PluginTemplateWrapper } from '../common/components/plugin_template_wrapper';
import { SecurityRoutePageWrapper } from '../common/components/security_route_page_wrapper';
import { withSecurityRoutePageWrapper } from '../common/components/security_route_page_wrapper';
import { AssetInventoryLoading } from './components/asset_inventory_loading';

const AssetsPageLazy = lazy(() => import('./pages'));
Expand All @@ -32,13 +32,11 @@ export const AssetInventoryRoutes = () => {
return (
<QueryClientProvider client={queryClient}>
<PluginTemplateWrapper>
<SecurityRoutePageWrapper pageName={SecurityPageName.assetInventory}>
<SecuritySolutionPageWrapper noPadding>
<Suspense fallback={<AssetInventoryLoading />}>
<AssetsPageLazy />
</Suspense>
</SecuritySolutionPageWrapper>
</SecurityRoutePageWrapper>
<SecuritySolutionPageWrapper noPadding>
<Suspense fallback={<AssetInventoryLoading />}>
<AssetsPageLazy />
</Suspense>
</SecuritySolutionPageWrapper>
</PluginTemplateWrapper>
</QueryClientProvider>
);
Expand All @@ -47,6 +45,8 @@ export const AssetInventoryRoutes = () => {
export const routes: SecuritySubPluginRoutes = [
{
path: ASSET_INVENTORY_PATH,
component: AssetInventoryRoutes,
component: withSecurityRoutePageWrapper(AssetInventoryRoutes, SecurityPageName.assetInventory, {
redirectOnMissing: true,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The redirectOnMissing option is becoming the default behaviour, which indicates that the parameter should not be necessary. We can improve the underlying logic/config.

I added a task to think about it in here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh nice! redirectOnMissing as default behaviour makes sense.

}),
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import React from 'react';
import { CLOUD_SECURITY_POSTURE_BASE_PATH } from '@kbn/cloud-security-posture-common';
import type { CloudSecurityPosturePageId } from '@kbn/cloud-security-posture-plugin/public';
import { type CspSecuritySolutionContext } from '@kbn/cloud-security-posture-plugin/public';
import { TrackApplicationView } from '@kbn/usage-collection-plugin/public';
import { useExpandableFlyoutApi } from '@kbn/expandable-flyout';
import type { SecurityPageName, SecuritySubPluginRoutes } from '../app/types';
import { SecurityPageName } from '../app/types';
import type { SecuritySubPluginRoutes } from '../app/types';
import { useKibana } from '../common/lib/kibana';
import { SecuritySolutionPageWrapper } from '../common/components/page_wrapper';
import { SpyRoute } from '../common/utils/route/spy_routes';
import { FiltersGlobal } from '../common/components/filters_global';
import { PluginTemplateWrapper } from '../common/components/plugin_template_wrapper';
import { useOnExpandableFlyoutClose } from '../flyout/shared/hooks/use_on_expandable_flyout_close';
import { withSecurityRoutePageWrapper } from '../common/components/security_route_page_wrapper';

// This exists only for the type signature cast
const CloudPostureSpyRoute = ({ pageName, ...rest }: { pageName?: CloudSecurityPosturePageId }) => (
Expand All @@ -37,11 +37,7 @@ const CloudSecurityPosture = () => {

return (
<PluginTemplateWrapper>
<TrackApplicationView viewId="cloud_security_posture">
<SecuritySolutionPageWrapper noPadding noTimeline>
<CloudSecurityPostureRouter securitySolutionContext={cspSecuritySolutionContext} />
</SecuritySolutionPageWrapper>
</TrackApplicationView>
<CloudSecurityPostureRouter securitySolutionContext={cspSecuritySolutionContext} />
</PluginTemplateWrapper>
);
};
Expand All @@ -51,6 +47,13 @@ CloudSecurityPosture.displayName = 'CloudSecurityPosture';
export const routes: SecuritySubPluginRoutes = [
{
path: CLOUD_SECURITY_POSTURE_BASE_PATH,
component: CloudSecurityPosture,
component: withSecurityRoutePageWrapper(
CloudSecurityPosture,
SecurityPageName.cloudSecurityPostureDashboard,
Comment thread
ashokaditya marked this conversation as resolved.
{
redirectOnMissing: true,
omitSpyRoute: true,
}
),
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const dashboardsLinks: LinkItem = {
title: DASHBOARDS,
path: DASHBOARDS_PATH,
globalNavPosition: 1,
capabilities: [`${SECURITY_FEATURE_ID}.show`],
capabilities: [[`${SECURITY_FEATURE_ID}.show`, `${SECURITY_FEATURE_ID}.detections`]],
globalSearchKeywords: [
i18n.translate('xpack.securitySolution.appLinks.dashboards', {
defaultMessage: 'Dashboards',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
* 2.0.
*/
import React from 'react';
import { TrackApplicationView } from '@kbn/usage-collection-plugin/public';

import { DASHBOARDS_PATH, SecurityPageName } from '../../common/constants';
import type { SecuritySubPluginRoutes } from '../app/types';
import { PluginTemplateWrapper } from '../common/components/plugin_template_wrapper';
import { DashboardsContainer } from './pages';
import { withSecurityRoutePageWrapper } from '../common/components/security_route_page_wrapper';

export const DashboardRoutes = () => (
<PluginTemplateWrapper>
<TrackApplicationView viewId={SecurityPageName.dashboards}>
<DashboardsContainer />
</TrackApplicationView>
<DashboardsContainer />
</PluginTemplateWrapper>
);

export const routes: SecuritySubPluginRoutes = [
{
path: DASHBOARDS_PATH,
component: DashboardRoutes,
component: withSecurityRoutePageWrapper(DashboardRoutes, SecurityPageName.dashboards, {
redirectOnMissing: true,
}),
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import { SpyRoute } from '../common/utils/route/spy_routes';
import { NotFoundPage } from '../app/404';
import { useReadonlyHeader } from '../use_readonly_header';
import { PluginTemplateWrapper } from '../common/components/plugin_template_wrapper';
import { SecurityRoutePageWrapper } from '../common/components/security_route_page_wrapper';
import {
SecurityRoutePageWrapper,
withSecurityRoutePageWrapper,
} from '../common/components/security_route_page_wrapper';

const ExceptionsRoutes = () => (
<PluginTemplateWrapper>
Expand Down Expand Up @@ -53,11 +56,11 @@ const ExceptionsContainerComponent: React.FC = () => {

const Exceptions = React.memo(ExceptionsContainerComponent);

const renderExceptionsRoutes = () => <Exceptions />;

export const routes = [
{
path: EXCEPTIONS_PATH,
render: renderExceptionsRoutes,
component: withSecurityRoutePageWrapper(Exceptions, SecurityPageName.exceptions, {
redirectOnMissing: true,
}),
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export const exploreLinks: LinkItem = {
title: EXPLORE,
path: EXPLORE_PATH,
globalNavPosition: 9,
capabilities: [`${SECURITY_FEATURE_ID}.show`],
capabilities: [[`${SECURITY_FEATURE_ID}.show`, `${SECURITY_FEATURE_ID}.detections`]],
globalSearchKeywords: [
i18n.translate('xpack.securitySolution.appLinks.explore', {
defaultMessage: 'Explore',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import React from 'react';
import { TrackApplicationView } from '@kbn/usage-collection-plugin/public';
import { UsersContainer } from './users/pages';
import { HostsContainer } from './hosts/pages';
import { NetworkContainer } from './network/pages';
Expand All @@ -16,56 +15,60 @@ import { SecurityPageName } from '../app/types';
import { EXPLORE_PATH, HOSTS_PATH, NETWORK_PATH, USERS_PATH } from '../../common/constants';
import { PluginTemplateWrapper } from '../common/components/plugin_template_wrapper';
import { ExploreLandingPage } from './landing';
import { SecurityRoutePageWrapper } from '../common/components/security_route_page_wrapper';
import { withSecurityRoutePageWrapper } from '../common/components/security_route_page_wrapper';

const ExploreLanding = () => (
<PluginTemplateWrapper>
<SecurityRoutePageWrapper pageName={SecurityPageName.exploreLanding} redirectOnMissing>
<ExploreLandingPage />
</SecurityRoutePageWrapper>
<ExploreLandingPage />
</PluginTemplateWrapper>
);

const NetworkRoutes = () => (
<PluginTemplateWrapper>
<TrackApplicationView viewId={SecurityPageName.network}>
<NetworkContainer />
</TrackApplicationView>
<NetworkContainer />
</PluginTemplateWrapper>
);

const UsersRoutes = () => (
<PluginTemplateWrapper>
<TrackApplicationView viewId={SecurityPageName.users}>
<UsersContainer />
</TrackApplicationView>
<UsersContainer />
</PluginTemplateWrapper>
);

const HostsRoutes = () => (
<PluginTemplateWrapper>
<TrackApplicationView viewId={SecurityPageName.hosts}>
<HostsContainer />
</TrackApplicationView>
<HostsContainer />
</PluginTemplateWrapper>
);

export const routes: SecuritySubPluginRoutes = [
{
path: EXPLORE_PATH,
exact: true,
component: ExploreLanding,
component: withSecurityRoutePageWrapper(ExploreLanding, SecurityPageName.exploreLanding, {
redirectOnMissing: true,
omitSpyRoute: true,
}),
},
{
path: NETWORK_PATH,
component: NetworkRoutes,
component: withSecurityRoutePageWrapper(NetworkRoutes, SecurityPageName.network, {
redirectOnMissing: true,
omitSpyRoute: true,
}),
},
{
path: USERS_PATH,
component: UsersRoutes,
component: withSecurityRoutePageWrapper(UsersRoutes, SecurityPageName.users, {
redirectOnMissing: true,
omitSpyRoute: true,
}),
},
{
path: HOSTS_PATH,
component: HostsRoutes,
component: withSecurityRoutePageWrapper(HostsRoutes, SecurityPageName.hosts, {
redirectOnMissing: true,
omitSpyRoute: true,
}),
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { HostIsolationExceptionsContainer } from './host_isolation_exceptions';
import { BlocklistContainer } from './blocklist';
import { ResponseActionsContainer } from './response_actions';
import { PrivilegedRoute } from '../components/privileged_route';
import { SecurityRoutePageWrapper } from '../../common/components/security_route_page_wrapper';

const EndpointTelemetry = () => (
<TrackApplicationView viewId={SecurityPageName.endpoints}>
Expand Down Expand Up @@ -80,11 +81,10 @@ const ResponseActionsTelemetry = () => (
</TrackApplicationView>
);

const NotesTelemetry = () => (
<TrackApplicationView viewId={SecurityPageName.notes}>
const Notes = () => (
<SecurityRoutePageWrapper pageName={SecurityPageName.notes} redirectOnMissing>
Comment thread
PhilippeOberti marked this conversation as resolved.
<NotesContainer />
<SpyRoute pageName={SecurityPageName.notes} />
</TrackApplicationView>
</SecurityRoutePageWrapper>
);

export const ManagementContainer = memo(() => {
Expand Down Expand Up @@ -163,7 +163,7 @@ export const ManagementContainer = memo(() => {
/>

{!securitySolutionNotesDisabled && (
<Route path={MANAGEMENT_ROUTING_NOTES_PATH} component={NotesTelemetry} />
<Route path={MANAGEMENT_ROUTING_NOTES_PATH} component={Notes} />
)}

{canReadEndpointList && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,22 @@

import React from 'react';
import { Route, Routes } from '@kbn/shared-ux-router';
import { TrackApplicationView } from '@kbn/usage-collection-plugin/public';
import { NoteManagementPage } from './pages/note_management_page';
import { SpyRoute } from '../common/utils/route/spy_routes';
import { NotFoundPage } from '../app/404';
import { NOTES_PATH, SecurityPageName } from '../../common/constants';
import { PluginTemplateWrapper } from '../common/components/plugin_template_wrapper';
import { withSecurityRoutePageWrapper } from '../common/components/security_route_page_wrapper';

const NotesManagementTelemetry = () => (
const NotesManagementWrapper = () => (
<PluginTemplateWrapper>
<TrackApplicationView viewId={SecurityPageName.notes}>
<NoteManagementPage />
<SpyRoute pageName={SecurityPageName.notes} />
</TrackApplicationView>
<NoteManagementPage />
</PluginTemplateWrapper>
);

const NotesManagementContainer: React.FC = React.memo(() => {
return (
<Routes>
<Route path={NOTES_PATH} exact component={NotesManagementTelemetry} />
<Route path={NOTES_PATH} exact component={NotesManagementWrapper} />
<Route component={NotFoundPage} />
</Routes>
);
Expand All @@ -36,6 +32,8 @@ NotesManagementContainer.displayName = 'NotesManagementContainer';
export const routes = [
{
path: NOTES_PATH,
component: NotesManagementContainer,
component: withSecurityRoutePageWrapper(NotesManagementContainer, SecurityPageName.notes, {
redirectOnMissing: true,
}),
},
];
Loading