From 01c8d1f4e2f5f7aede9b0ea18b6df0cd216ab46f Mon Sep 17 00:00:00 2001
From: Kevin Qualters <56408403+kqualters-elastic@users.noreply.github.com>
Date: Mon, 25 Aug 2025 05:05:19 -0400
Subject: [PATCH] [Security Solution] [Alerts] Fix deprecated pageNames with
redirects (#232558)
## Summary
Related issue: https://github.com/elastic/kibana/issues/232557
This pr fixes an issue where deprecated pages that are not registered
with the global navigation and search, as the now deprecated
app/security/detections/* routes are, but did have custom redirect logic
with react router components, stopped working as a result of a recent
change https://github.com/elastic/kibana/pull/217890 that prevented any
of this logic from running if the route was not registered globally,
"useLinkInfo" is the hook below that checks this. Alert actions use an
older url, app/security/detections/rules/id/{ruleId}, and redirect at
the application level to the new url app/security/rules/id/{ruleId} and
so this pr explicitly excludes the old route from this check, because we
should also continue to not show a detections result in the global
search bar that just redirects to the alerts page. Open to doing this in
another way if we want, but this seemed the most direct and lowest
friction way to make this core functionality work again.
Before:

After:

### Checklist
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
(cherry picked from commit c4d6fbace44838293a553e9ac40ba0db9db8cc15)
---
.../security_route_page_wrapper.tsx | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/x-pack/solutions/security/plugins/security_solution/public/common/components/security_route_page_wrapper/security_route_page_wrapper.tsx b/x-pack/solutions/security/plugins/security_solution/public/common/components/security_route_page_wrapper/security_route_page_wrapper.tsx
index b13061e2b3565..68851c0cb735a 100644
--- a/x-pack/solutions/security/plugins/security_solution/public/common/components/security_route_page_wrapper/security_route_page_wrapper.tsx
+++ b/x-pack/solutions/security/plugins/security_solution/public/common/components/security_route_page_wrapper/security_route_page_wrapper.tsx
@@ -8,7 +8,7 @@
import React, { type PropsWithChildren } from 'react';
import { Redirect } from 'react-router-dom';
import { TrackApplicationView } from '@kbn/usage-collection-plugin/public';
-import type { SecurityPageName } from '../../../../common';
+import { SecurityPageName } from '../../../../common';
import { useLinkInfo } from '../../links';
import { NoPrivilegesPage } from '../no_privileges';
import { useUpsellingPage } from '../../hooks/use_upselling';
@@ -26,6 +26,8 @@ type SecurityRoutePageWrapperProps = {
pageName: SecurityPageName;
} & SecurityRoutePageWrapperOptionProps;
+const deprectedPagesWithRedirect = [SecurityPageName.detections];
+
/**
* This component is created to wrap all the pages in the security solution app.
*
@@ -61,12 +63,13 @@ export const SecurityRoutePageWrapper: React.FC;
}
// Show the no privileges page if the link is unauthorized.
- if (link.unauthorized) {
+ if (link && link.unauthorized) {
return (
<>