Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

open drawer on loading

Matheus Nogueira8e94c1638986
diff --git a/backend/src/ee/services/honey-token/honey-token-config-service.ts b/backend/src/ee/services/honey-token/honey-token-config-service.ts
index 847ebdf82a..a09e4c2439 100644
--- a/backend/src/ee/services/honey-token/honey-token-config-service.ts
+++ b/backend/src/ee/services/honey-token/honey-token-config-service.ts
@@ -302,7 +302,7 @@ export const honeyTokenConfigServiceFactory = ({
eventTime: eventMetadata.eventTime,
sourceIp: eventMetadata.sourceIp || "Unknown",
awsRegion: eventMetadata.awsRegion,
- projectUrl: `${siteUrl}/organizations/${orgId}/projects/secret-management/${project.id}/honey-tokens/${honeyToken.id}`
+ projectUrl: `${siteUrl}/organizations/${orgId}/projects/secret-management/${project.id}/overview?honeyTokenId=${honeyToken.id}`
}
});
} catch (err) {
diff --git a/frontend/src/components/honey-tokens/HoneyTokenDetailsDrawer.tsx b/frontend/src/components/honey-tokens/HoneyTokenDetailsDrawer.tsx
index a81971f802..087203acc2 100644
--- a/frontend/src/components/honey-tokens/HoneyTokenDetailsDrawer.tsx
+++ b/frontend/src/components/honey-tokens/HoneyTokenDetailsDrawer.tsx
@@ -1,4 +1,4 @@
-import { forwardRef, useEffect, useImperativeHandle, useReducer, useState } from "react";
+import { useEffect, useReducer, useState } from "react";
import { format, formatDistanceToNow } from "date-fns";
import {
AlertTriangle,
@@ -53,14 +53,13 @@ import {
useGetHoneyTokenById,
useGetHoneyTokenCredentials
} from "@app/hooks/api/honeyTokens/queries";
-import { HoneyTokenEventsSection } from "@app/pages/secret-manager/HoneyTokenDetailsByIDPage/components";
-export type HoneyTokenDetailsDrawerHandle = {
- open: (honeyTokenId: string) => void;
-};
+import { HoneyTokenEventsSection } from "./HoneyTokenEventsSection";
type Props = {
projectId: string;
+ honeyTokenId: string | null;
+ onClose: () => void;
};
const CredentialField = ({ label, value }: { label: string; value?: string }) => {
@@ -434,20 +433,16 @@ const DrawerContent = ({
);
};
-export const HoneyTokenDetailsDrawer = forwardRef<HoneyTokenDetailsDrawerHandle, Props>(
- ({ projectId }, ref) => {
- const [honeyTokenId, setHoneyTokenId] = useState<string | null>(null);
- const isOpen = Boolean(honeyTokenId);
+export const HoneyTokenDetailsDrawer = ({ projectId, honeyTokenId, onClose }: Props) => {
+ const isOpen = Boolean(honeyTokenId);
- useImperativeHandle(ref, () => ({
- open: (id: string) => setHoneyTokenId(id)
- }));
+ console.log("[HoneyTokenDetailsDrawer] render", { honeyTokenId, isOpen, projectId });
return (
<Sheet
open={isOpen}
onOpenChange={(open) => {
- if (!open) setHoneyTokenId(null);
+ if (!open) onClose();
}}
>
<SheetContent className="flex h-full flex-col gap-y-0 overflow-y-auto sm:max-w-3xl">
@@ -460,7 +455,4 @@ export const HoneyTokenDetailsDrawer = forwardRef<HoneyTokenDetailsDrawerHandle,
</SheetContent>
</Sheet>
);
- }
-);
-
-HoneyTokenDetailsDrawer.displayName = "HoneyTokenDetailsDrawer";
+};
diff --git a/frontend/src/pages/secret-manager/HoneyTokenDetailsByIDPage/components/HoneyTokenEventsSection.tsx b/frontend/src/components/honey-tokens/HoneyTokenEventsSection.tsx
similarity index 100%
rename from frontend/src/pages/secret-manager/HoneyTokenDetailsByIDPage/components/HoneyTokenEventsSection.tsx
rename to frontend/src/components/honey-tokens/HoneyTokenEventsSection.tsx
diff --git a/frontend/src/const/routes.ts b/frontend/src/const/routes.ts
index e3b4f5cca8..425cbb7bb3 100644
--- a/frontend/src/const/routes.ts
+++ b/frontend/src/const/routes.ts
@@ -111,10 +111,6 @@ export const ROUTE_PATHS = Object.freeze({
"/organizations/$orgId/projects/secret-management/$projectId/insights",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/insights"
),
- HoneyTokenDetailsByIDPage: setRoute(
- "/organizations/$orgId/projects/secret-management/$projectId/honey-tokens/$honeyTokenId",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/honey-tokens/$honeyTokenId"
- ),
IntegrationDetailsByIDPage: setRoute(
"/organizations/$orgId/projects/secret-management/$projectId/integrations/$integrationId",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/$integrationId"
diff --git a/frontend/src/pages/secret-manager/HoneyTokenDetailsByIDPage/HoneyTokenDetailsByIDPage.tsx b/frontend/src/pages/secret-manager/HoneyTokenDetailsByIDPage/HoneyTokenDetailsByIDPage.tsx
deleted file mode 100644
index cdf4ad039a..0000000000
--- a/frontend/src/pages/secret-manager/HoneyTokenDetailsByIDPage/HoneyTokenDetailsByIDPage.tsx
+++ /dev/null
@@ -1,493 +0,0 @@
-import { useEffect, useReducer, useState } from "react";
-import { Helmet } from "react-helmet";
-import { useNavigate, useParams } from "@tanstack/react-router";
-import { format, formatDistanceToNow } from "date-fns";
-import {
- AlertTriangle,
- BanIcon,
- CalendarIcon,
- Check,
- ChevronLeftIcon,
- ClipboardCopy,
- ClockIcon,
- EyeOff,
- KeyIcon,
- MapPinIcon,
- RotateCcw,
- HexagonIcon
-} from "lucide-react";
-import { twMerge } from "tailwind-merge";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import {
- AlertDialog,
- AlertDialogAction,
- AlertDialogCancel,
- AlertDialogContent,
- AlertDialogDescription,
- AlertDialogFooter,
- AlertDialogHeader,
- AlertDialogMedia,
- AlertDialogTitle,
- Badge,
- Button,
- Empty,
- EmptyHeader,
- EmptyTitle,
- Field,
- FieldContent,
- FieldLabel,
- IconButton,
- Input,
- PageLoader,
- Skeleton,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-import { ROUTE_PATHS } from "@app/const/routes";
-import { ProjectPermissionSub } from "@app/context";
-import { ProjectPermissionSecretActions } from "@app/context/ProjectPermissionContext/types";
-import { HONEY_TOKEN_CREDENTIAL_FIELDS, HONEY_TOKEN_MAP } from "@app/helpers/honeyTokens";
-import { useTimedReset } from "@app/hooks";
-import { HoneyTokenStatus, HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";
-import { useResetHoneyToken, useRevokeHoneyToken } from "@app/hooks/api/honeyTokens/mutations";
-import {
- useGetHoneyTokenById,
- useGetHoneyTokenCredentials
-} from "@app/hooks/api/honeyTokens/queries";
-
-import { HoneyTokenEventsSection } from "./components";
-
-const CredentialField = ({ label, value }: { label: string; value?: string }) => {
- const [showCredential, toggleShowCredential] = useReducer((prev) => !prev, false);
- const [, isCopied, setCopied] = useTimedReset<string>({ initialState: "" });
-
- if (!value) return null;
-
- return (
- <Field>
- <FieldLabel>{label}</FieldLabel>
- <FieldContent>
- <div className="flex w-full min-w-0 items-center gap-1">
- <span
- className="min-w-0 flex-1 truncate font-mono text-sm"
- title={showCredential ? value : undefined}
- >
- {showCredential ? value : "****************************"}
- </span>
- <Tooltip>
- <TooltipTrigger asChild>
- <IconButton
- variant="ghost"
- size="xs"
- onClick={() => {
- setCopied(value);
- navigator.clipboard.writeText(value);
- }}
- aria-label={`Copy ${label}`}
- >
- {isCopied ? (
- <Check className="size-3.5" />
- ) : (
- <ClipboardCopy className="size-3.5" />
- )}
- </IconButton>
- </TooltipTrigger>
- <TooltipContent>Copy {label}</TooltipContent>
- </Tooltip>
- <Tooltip>
- <TooltipTrigger asChild>
- <IconButton
- variant="ghost"
- size="xs"
- onClick={toggleShowCredential}
- aria-label={`${showCredential ? "Hide" : "Show"} ${label}`}
- >
- <EyeOff className="size-3.5" />
- </IconButton>
- </TooltipTrigger>
- <TooltipContent>
- {showCredential ? "Hide" : "Show"} {label}
- </TooltipContent>
- </Tooltip>
- </div>
- </FieldContent>
- </Field>
- );
-};
-
-const PageContent = () => {
- const navigate = useNavigate();
- const { honeyTokenId, projectId, orgId } = useParams({
- from: ROUTE_PATHS.SecretManager.HoneyTokenDetailsByIDPage.id
- });
-
- const { data: honeyToken, isPending } = useGetHoneyTokenById({
- honeyTokenId,
- projectId,
- enabled: Boolean(honeyTokenId && projectId)
- });
-
- const { mutateAsync: resetHoneyToken } = useResetHoneyToken();
- const { mutateAsync: revokeHoneyToken } = useRevokeHoneyToken();
- const [isRevokeOpen, setIsRevokeOpen] = useState(false);
- const [isResetOpen, setIsResetOpen] = useState(false);
- const [revokeInput, setRevokeInput] = useState("");
- const { data: credentials, isPending: isCredentialsPending } = useGetHoneyTokenCredentials({
- honeyTokenId,
- projectId,
- enabled: Boolean(honeyTokenId && projectId)
- });
-
- useEffect(() => {
- setRevokeInput("");
- }, [isRevokeOpen]);
-
- if (isPending) {
- return (
- <div className="flex h-full w-full items-center justify-center">
- <PageLoader />
- </div>
- );
- }
-
- if (!honeyToken) {
- return (
- <div className="flex h-full w-full items-center justify-center px-20">
- <Empty>
- <EmptyHeader>
- <EmptyTitle>Could not find honey token with ID {honeyTokenId}</EmptyTitle>
- </EmptyHeader>
- </Empty>
- </div>
- );
- }
-
- const isTriggered = honeyToken.status === HoneyTokenStatus.Triggered;
- const isRevoked = honeyToken.status === HoneyTokenStatus.Revoked;
- const tokenInfo = HONEY_TOKEN_MAP[honeyToken.type as HoneyTokenType];
-
- let statusBadgeVariant: "danger" | "neutral" | "success" = "success";
- let statusLabel = "Active";
- if (isTriggered) {
- statusBadgeVariant = "danger";
- statusLabel = "Triggered";
- } else if (isRevoked) {
- statusBadgeVariant = "neutral";
- statusLabel = "Revoked";
- }
-
- const handleReset = async () => {
- await resetHoneyToken({
- honeyTokenId: honeyToken.id,
- projectId
- });
- createNotification({
- text: `Honey token "${honeyToken.name}" has been reset`,
- type: "success"
- });
- };
-
- const handleRevoke = async () => {
- await revokeHoneyToken({
- honeyTokenId: honeyToken.id,
- projectId
- });
- createNotification({
- text: `Successfully revoked honey token "${honeyToken.name}"`,
- type: "success"
- });
- };
-
- return (
- <>
- <Helmet>
- <title>{honeyToken.name} | Honey Token</title>
- </Helmet>
- <div className="container mx-auto flex flex-col justify-between bg-bunker-800 font-inter text-white">
- <div className="mx-auto mb-6 w-full max-w-8xl">
- <Button
- variant="ghost"
- onClick={() => {
- navigate({
- to: ROUTE_PATHS.SecretManager.OverviewPage.path,
- params: { orgId, projectId }
- });
- }}
- >
- <ChevronLeftIcon size={14} />
- Overview
- </Button>
-
- <div className="mt-2 mb-4 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-5">
- <div className="flex items-start justify-between">
- <div className="flex items-center gap-3">
- <div className="flex h-11 w-11 items-center justify-center rounded-lg border border-mineshaft-600 bg-mineshaft-800">
- <HexagonIcon
- className={twMerge(
- isTriggered && "text-red-500",
- isRevoked && "text-mineshaft-400",
- !isTriggered && !isRevoked && "text-yellow-500"
- )}
- size={22}
- />
- </div>
- <div className="min-w-0">
- <div className="flex items-center gap-2.5">
- <p className="truncate text-lg font-medium text-white">{honeyToken.name}</p>
- <Badge variant={statusBadgeVariant}>
- {isTriggered && <AlertTriangle size={12} className="mr-1" />}
- {statusLabel}
- </Badge>
- {tokenInfo && (
- <Badge variant="neutral" className="flex items-center gap-1">
- <img
- src={`/images/integrations/${tokenInfo.image}`}
- style={{ width: "11px" }}
- alt={`${tokenInfo.name} logo`}
- />
- {tokenInfo.name}
- </Badge>
- )}
- </div>
- <p className="text-xs text-bunker-300">
- {honeyToken.description || `${tokenInfo?.name ?? "Honey"} Token`}
- </p>
- </div>
- </div>
- <div className="flex shrink-0 items-center gap-2">
- {isTriggered && (
- <Button variant="outline" size="xs" onClick={() => setIsResetOpen(true)}>
- <RotateCcw size={14} />
- Reset
- </Button>
- )}
- {!isRevoked && (
- <Button variant="danger" size="xs" onClick={() => setIsRevokeOpen(true)}>
- <BanIcon size={14} />
- Revoke
- </Button>
- )}
- </div>
- </div>
-
- <div className="mt-4 flex flex-wrap items-center gap-x-6 gap-y-2 border-t border-mineshaft-600 pt-4 text-xs text-bunker-300">
- <Tooltip>
- <TooltipTrigger asChild>
- <div className="flex items-center gap-1.5">
- <CalendarIcon size={13} />
- <span>
- Created{" "}
- {formatDistanceToNow(new Date(honeyToken.createdAt), { addSuffix: true })}
- </span>
- </div>
- </TooltipTrigger>
- <TooltipContent>
- {format(new Date(honeyToken.createdAt), "MMMM do, yyyy 'at' h:mm a")}
- </TooltipContent>
- </Tooltip>
- {honeyToken.environment && (
- <div className="flex items-center gap-1.5">
- <MapPinIcon size={13} />
- <span>
- {honeyToken.environment.name}
- {honeyToken.folder?.path && honeyToken.folder.path !== "/"
- ? ` — ${honeyToken.folder.path}`
- : ""}
- </span>
- </div>
- )}
- <div className="flex items-center gap-1.5">
- <HexagonIcon size={13} />
- <span>
- {honeyToken.openEvents} open event{honeyToken.openEvents !== 1 && "s"}
- </span>
- </div>
- <div className="flex items-center gap-1.5">
- <ClockIcon size={13} />
- <span>Active for {formatDistanceToNow(new Date(honeyToken.createdAt))}</span>
- </div>
- </div>
-
- {!isRevoked && (
- <ProjectPermissionCan
- I={ProjectPermissionSecretActions.DescribeAndReadValue}
- a={ProjectPermissionSub.Secrets}
- >
- {(isAllowed) =>
- isAllowed && (
- <div className="mt-4 border-t border-mineshaft-600 pt-4">
- <div className="mb-2 flex items-center gap-1.5 text-xs text-bunker-300">
- <KeyIcon size={13} />
- <span>Credentials</span>
- </div>
- {isCredentialsPending && (
- <div className="flex flex-col gap-2 py-2">
- <Skeleton className="h-8 w-full rounded-md" />
- <Skeleton className="h-8 w-full rounded-md" />
- </div>
- )}
- {!isCredentialsPending && credentials && (
- <div className="flex flex-col gap-4">
- {(
- HONEY_TOKEN_CREDENTIAL_FIELDS[honeyToken.type as HoneyTokenType] ?? []
- ).map(({ key, label }) => {
- const mapping = honeyToken.secretsMapping as Record<string, string>;
- const secretName = mapping[key];
- const value = secretName ? credentials[secretName] : undefined;
- return <CredentialField key={key} label={label} value={value} />;
- })}
- </div>
- )}
- {!isCredentialsPending && !credentials && (
- <p className="text-xs text-bunker-400">No credentials available.</p>
- )}
- </div>
- )
- }
- </ProjectPermissionCan>
- )}
-
- {isRevoked && (
- <div className="mt-4 rounded-md border border-mineshaft-600 bg-mineshaft-800 p-4">
- <div className="mb-2 flex items-center gap-2">
- <BanIcon size={16} className="text-mineshaft-400" />
- <p className="text-sm font-medium text-mineshaft-300">Honey token revoked</p>
- </div>
- <p className="text-xs text-bunker-300">
- The AWS IAM credentials have been revoked and the decoy secrets removed. The honey
- token record and its events are preserved for audit purposes.
- </p>
- </div>
- )}
-
- {isTriggered && (
- <div className="mt-4 rounded-md border border-yellow-800/50 bg-yellow-900/20 p-4">
- <div className="mb-2 flex items-center gap-2">
- <AlertTriangle size={16} className="text-yellow-500" />
- <p className="text-sm font-medium text-yellow-500">
- Respond to a triggered honeytoken
- </p>
- </div>
- <p className="mb-3 text-xs text-bunker-300">
- Investigate. The events below give you information about when, where, and how the
- key was used.
- </p>
- <div className="flex gap-6">
- <div className="flex-1">
- <p className="text-xs font-medium text-white">1. False alarm confirmed?</p>
- <p className="text-xs text-bunker-300">
- You might want to <strong>reset the honeytoken</strong>. This will revert its
- status to active and hide the past events, so that the honeytoken can be
- triggered again.
- </p>
- </div>
- <div className="flex-1">
- <p className="text-xs font-medium text-white">
- 2. Malicious activity confirmed?
- </p>
- <p className="text-xs text-bunker-300">
- 1. Take immediate steps as per your company Incident Response Plan.
- <br />
- 2. <strong>Rotate any real secrets</strong> that were stored alongside the
- honeytoken, as they may also be compromised.
- <br />
- 3. <strong>Revoke the honeytoken</strong>. This will prevent any new
- connections while we keep the compromised key in our records.
- <br />
- 4. Don&apos;t forget to recreate a new honeytoken to replace it in the same
- location.
- </p>
- </div>
- </div>
- </div>
- )}
- </div>
-
- <HoneyTokenEventsSection honeyTokenId={honeyTokenId} projectId={projectId} />
- </div>
- </div>
- <AlertDialog open={isResetOpen} onOpenChange={setIsResetOpen}>
- <AlertDialogContent>
- <AlertDialogHeader>
- <AlertDialogMedia>
- <RotateCcw />
- </AlertDialogMedia>
- <AlertDialogTitle>Reset {honeyToken.name}?</AlertDialogTitle>
- <AlertDialogDescription>
- This will revert the honey token status to active and hide past events. The honey
- token will be able to trigger again on new activity.
- </AlertDialogDescription>
- </AlertDialogHeader>
- <AlertDialogFooter>
- <AlertDialogCancel>Cancel</AlertDialogCancel>
- <AlertDialogAction
- onClick={async () => {
- await handleReset();
- setIsResetOpen(false);
- }}
- >
- Reset
- </AlertDialogAction>
- </AlertDialogFooter>
- </AlertDialogContent>
- </AlertDialog>
- <AlertDialog open={isRevokeOpen} onOpenChange={setIsRevokeOpen}>
- <AlertDialogContent className="sm:max-w-xl!">
- <AlertDialogHeader>
- <AlertDialogMedia>
- <BanIcon />
- </AlertDialogMedia>
- <AlertDialogTitle>Are you sure you want to revoke {honeyToken.name}?</AlertDialogTitle>
- <AlertDialogDescription>
- This will revoke the AWS IAM credentials and remove the associated decoy secrets from
- this environment. The honey token record and its events will be preserved for audit
- purposes.
- </AlertDialogDescription>
- </AlertDialogHeader>
- <form
- onSubmit={(e) => {
- e.preventDefault();
- if (revokeInput === honeyToken.name) handleRevoke();
- }}
- >
- <Field>
- <FieldLabel>
- Type <span className="font-bold">{honeyToken.name}</span> to confirm
- </FieldLabel>
- <FieldContent>
- <Input
- value={revokeInput}
- onChange={(e) => setRevokeInput(e.target.value)}
- placeholder={`Type ${honeyToken.name} here`}
- />
- </FieldContent>
- </Field>
- </form>
- <AlertDialogFooter>
- <AlertDialogCancel>Cancel</AlertDialogCancel>
- <AlertDialogAction
- variant="danger"
- onClick={handleRevoke}
- disabled={revokeInput !== honeyToken.name}
- >
- Revoke
- </AlertDialogAction>
- </AlertDialogFooter>
- </AlertDialogContent>
- </AlertDialog>
- </>
- );
-};
-
-export const HoneyTokenDetailsByIDPage = () => (
- <ProjectPermissionCan
- I={ProjectPermissionSecretActions.DescribeSecret}
- a={ProjectPermissionSub.Secrets}
- renderGuardBanner
- >
- <PageContent />
- </ProjectPermissionCan>
-);
diff --git a/frontend/src/pages/secret-manager/HoneyTokenDetailsByIDPage/components/index.ts b/frontend/src/pages/secret-manager/HoneyTokenDetailsByIDPage/components/index.ts
deleted file mode 100644
index cc1eb6b71b..0000000000
--- a/frontend/src/pages/secret-manager/HoneyTokenDetailsByIDPage/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { HoneyTokenEventsSection } from "./HoneyTokenEventsSection";
diff --git a/frontend/src/pages/secret-manager/HoneyTokenDetailsByIDPage/route.tsx b/frontend/src/pages/secret-manager/HoneyTokenDetailsByIDPage/route.tsx
deleted file mode 100644
index c7592195ac..0000000000
--- a/frontend/src/pages/secret-manager/HoneyTokenDetailsByIDPage/route.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { createFileRoute, linkOptions } from "@tanstack/react-router";
-
-import { HoneyTokenDetailsByIDPage } from "./HoneyTokenDetailsByIDPage";
-
-export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/honey-tokens/$honeyTokenId"
-)({
- component: HoneyTokenDetailsByIDPage,
- beforeLoad: ({ context, params }) => {
- return {
- breadcrumbs: [
- ...context.breadcrumbs,
- {
- label: "Overview",
- link: linkOptions({
- to: "/organizations/$orgId/projects/secret-management/$projectId/overview",
- params
- })
- },
- {
- label: "Honey Token"
- }
- ]
- };
- }
-});
diff --git a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
index 9cb78aa85c..e263e6e184 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
@@ -28,7 +28,6 @@ import {
CreateHoneyTokenModal,
EditHoneyTokenModal,
HoneyTokenDetailsDrawer,
- type HoneyTokenDetailsDrawerHandle,
RevokeHoneyTokenModal,
ViewHoneyTokenCredentialsModal
} from "@app/components/honey-tokens";
@@ -284,6 +283,7 @@ const OverviewPageContent = () => {
search: el.search,
environments: el.environments,
dynamicSecretId: el.dynamicSecretId,
+ honeyTokenId: el.honeyTokenId,
filterBy: el.filterBy
})
});
@@ -789,7 +789,21 @@ const OverviewPageContent = () => {
"viewHoneyTokenCredentials"
] as const);
- const honeyTokenDetailsRef = useRef<HoneyTokenDetailsDrawerHandle>(null);
+ const [detailsDrawerHoneyTokenId, setDetailsDrawerHoneyTokenId] = useState<string | null>(null);
+
+ console.log("[HoneyTokenDrawer] render", {
+ detailsDrawerHoneyTokenId,
+ routerSearchHoneyTokenId: routerSearch.honeyTokenId
+ });
+
+ // Auto-open honey token drawer when linked via notification/email
+ useEffect(() => {
+ console.log("[HoneyTokenDrawer] useEffect fired", { honeyTokenId: routerSearch.honeyTokenId });
+ if (routerSearch.honeyTokenId) {
+ console.log("[HoneyTokenDrawer] setting drawer id to", routerSearch.honeyTokenId);
+ setDetailsDrawerHoneyTokenId(routerSearch.honeyTokenId);
+ }
+ }, [routerSearch.honeyTokenId]);
// Auto-open dynamic secret leases modal when linked via notification/email
useEffect(() => {
@@ -3106,7 +3120,7 @@ const OverviewPageContent = () => {
handlePopUpOpen("viewHoneyTokenCredentials", honeyToken)
}
onViewDetails={(honeyToken) =>
- honeyTokenDetailsRef.current?.open(honeyToken.id)
+ setDetailsDrawerHoneyTokenId(honeyToken.id)
}
/>
))}
@@ -3463,7 +3477,16 @@ const OverviewPageContent = () => {
projectId={projectId}
onOpenChange={(isOpen) => handlePopUpToggle("viewHoneyTokenCredentials", isOpen)}
/>
- <HoneyTokenDetailsDrawer ref={honeyTokenDetailsRef} projectId={projectId} />
+ <HoneyTokenDetailsDrawer
+ projectId={projectId}
+ honeyTokenId={detailsDrawerHoneyTokenId}
+ onClose={() => {
+ setDetailsDrawerHoneyTokenId(null);
+ if (routerSearch.honeyTokenId) {
+ navigate({ search: (prev) => ({ ...prev, honeyTokenId: undefined }), replace: true });
+ }
+ }}
+ />
<ImportSecretsModal
isOpen={popUp.importSecrets.isOpen}
onOpenChange={(isOpen) => {
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/HoneyTokenTableRow/HoneyTokenTableRow.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/HoneyTokenTableRow/HoneyTokenTableRow.tsx
index cb14132d3c..15c2283bdd 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/HoneyTokenTableRow/HoneyTokenTableRow.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/HoneyTokenTableRow/HoneyTokenTableRow.tsx
@@ -270,7 +270,10 @@ export const HoneyTokenTableRow = ({
environments.map(({ slug }, i) => {
if (isExpanded)
return (
- <TableCell key={`ht-overview-${slug}-${i + 1}`} className="border-b-0 bg-container-hover" />
+ <TableCell
+ key={`ht-overview-${slug}-${i + 1}`}
+ className="border-b-0 bg-container-hover"
+ />
);
const isPresent = isHoneyTokenInEnv(honeyTokenName, slug);
diff --git a/frontend/src/pages/secret-manager/OverviewPage/route.tsx b/frontend/src/pages/secret-manager/OverviewPage/route.tsx
index 9be6f8f0c2..26b1bc930b 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/route.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/route.tsx
@@ -11,6 +11,7 @@ const SecretOverviewPageQuerySchema = z.object({
connectionName: z.string().optional(),
environments: z.array(z.string()).catch([]),
dynamicSecretId: z.string().optional(),
+ honeyTokenId: z.string().optional(),
filterBy: z.string().optional()
});
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/HoneyTokenListView/HoneyTokenListView.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/HoneyTokenListView/HoneyTokenListView.tsx
index 27c55ca654..6c2c7f28d6 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/HoneyTokenListView/HoneyTokenListView.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/HoneyTokenListView/HoneyTokenListView.tsx
@@ -1,9 +1,8 @@
-import { useRef, useState } from "react";
+import { useState } from "react";
import {
EditHoneyTokenModal,
HoneyTokenDetailsDrawer,
- type HoneyTokenDetailsDrawerHandle,
RevokeHoneyTokenModal,
ViewHoneyTokenCredentialsModal
} from "@app/components/honey-tokens";
@@ -22,7 +21,7 @@ export const HoneyTokenListView = ({ honeyTokens }: Props) => {
const [revokeTarget, setRevokeTarget] = useState<TDashboardHoneyToken>();
const [editTarget, setEditTarget] = useState<TDashboardHoneyToken>();
const [credentialsTarget, setCredentialsTarget] = useState<TDashboardHoneyToken>();
- const honeyTokenDetailsRef = useRef<HoneyTokenDetailsDrawerHandle>(null);
+ const [detailsHoneyTokenId, setDetailsHoneyTokenId] = useState<string | null>(null);
return (
<>
@@ -33,7 +32,7 @@ export const HoneyTokenListView = ({ honeyTokens }: Props) => {
onEdit={() => setEditTarget(honeyToken)}
onRevoke={() => setRevokeTarget(honeyToken)}
onViewCredentials={() => setCredentialsTarget(honeyToken)}
- onViewDetails={() => honeyTokenDetailsRef.current?.open(honeyToken.id)}
+ onViewDetails={() => setDetailsHoneyTokenId(honeyToken.id)}
/>
))}
<EditHoneyTokenModal
@@ -58,7 +57,11 @@ export const HoneyTokenListView = ({ honeyTokens }: Props) => {
honeyToken={credentialsTarget}
projectId={projectId}
/>
- <HoneyTokenDetailsDrawer ref={honeyTokenDetailsRef} projectId={projectId} />
+ <HoneyTokenDetailsDrawer
+ projectId={projectId}
+ honeyTokenId={detailsHoneyTokenId}
+ onClose={() => setDetailsHoneyTokenId(null)}
+ />
</>
);
};
diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.ts
index 4dc550bcbe..4668156fc8 100644
--- a/frontend/src/routeTree.gen.ts
+++ b/frontend/src/routeTree.gen.ts
@@ -157,7 +157,6 @@ import { Route as sshSshCaByIDPageRouteImport } from './pages/ssh/SshCaByIDPage/
import { Route as secretManagerSecretDashboardPageRouteImport } from './pages/secret-manager/SecretDashboardPage/route'
import { Route as secretManagerIntegrationsSelectIntegrationAuthPageRouteImport } from './pages/secret-manager/integrations/SelectIntegrationAuthPage/route'
import { Route as secretManagerIntegrationsDetailsByIDPageRouteImport } from './pages/secret-manager/IntegrationsDetailsByIDPage/route'
-import { Route as secretManagerHoneyTokenDetailsByIDPageRouteImport } from './pages/secret-manager/HoneyTokenDetailsByIDPage/route'
import { Route as pamPamSessionsByIDPageRouteImport } from './pages/pam/PamSessionsByIDPage/route'
import { Route as pamApprovalRequestDetailPageRouteImport } from './pages/pam/ApprovalRequestDetailPage/route'
import { Route as certManagerPkiSubscriberDetailsByIDPageRouteImport } from './pages/cert-manager/PkiSubscriberDetailsByIDPage/route'
@@ -1669,13 +1668,6 @@ const secretManagerIntegrationsDetailsByIDPageRouteRoute =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutIntegrationsRoute,
} as any)
-const secretManagerHoneyTokenDetailsByIDPageRouteRoute =
- secretManagerHoneyTokenDetailsByIDPageRouteImport.update({
- id: '/honey-tokens/$honeyTokenId',
- path: '/honey-tokens/$honeyTokenId',
- getParentRoute: () => secretManagerLayoutRoute,
- } as any)
-
const pamPamSessionsByIDPageRouteRoute =
pamPamSessionsByIDPageRouteImport.update({
id: '/$sessionId',
@@ -3766,13 +3758,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof pamPamSessionsByIDPageRouteImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutSessionsImport
}
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/honey-tokens/$honeyTokenId': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/honey-tokens/$honeyTokenId'
- path: '/honey-tokens/$honeyTokenId'
- fullPath: '/organizations/$orgId/projects/secret-management/$projectId/honey-tokens/$honeyTokenId'
- preLoaderRoute: typeof secretManagerHoneyTokenDetailsByIDPageRouteImport
- parentRoute: typeof secretManagerLayoutImport
- }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/$integrationId': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/$integrationId'
path: '/$integrationId'
@@ -5479,7 +5464,6 @@ interface secretManagerLayoutRouteChildren {
projectAppConnectionsPageRouteSecretManagerRoute: typeof projectAppConnectionsPageRouteSecretManagerRoute
projectAuditLogsPageRouteSecretManagerRoute: typeof projectAuditLogsPageRouteSecretManagerRoute
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutIntegrationsRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutIntegrationsRouteWithChildren
- secretManagerHoneyTokenDetailsByIDPageRouteRoute: typeof secretManagerHoneyTokenDetailsByIDPageRouteRoute
secretManagerSecretDashboardPageRouteRoute: typeof secretManagerSecretDashboardPageRouteRoute
projectGroupDetailsByIDPageRouteSecretManagerRoute: typeof projectGroupDetailsByIDPageRouteSecretManagerRoute
projectIdentityDetailsByIDPageRouteSecretManagerRoute: typeof projectIdentityDetailsByIDPageRouteSecretManagerRoute
@@ -5504,8 +5488,6 @@ const secretManagerLayoutRouteChildren: secretManagerLayoutRouteChildren = {
projectAuditLogsPageRouteSecretManagerRoute,
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutIntegrationsRoute:
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutIntegrationsRouteWithChildren,
- secretManagerHoneyTokenDetailsByIDPageRouteRoute:
- secretManagerHoneyTokenDetailsByIDPageRouteRoute,
secretManagerSecretDashboardPageRouteRoute:
secretManagerSecretDashboardPageRouteRoute,
projectGroupDetailsByIDPageRouteSecretManagerRoute:
@@ -6155,7 +6137,6 @@ export interface FileRoutesByFullPath {
'/organizations/$orgId/projects/cert-manager/$projectId/subscribers/$subscriberName': typeof certManagerPkiSubscriberDetailsByIDPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/approvals/$approvalRequestId': typeof pamApprovalRequestDetailPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/sessions/$sessionId': typeof pamPamSessionsByIDPageRouteRoute
- '/organizations/$orgId/projects/secret-management/$projectId/honey-tokens/$honeyTokenId': typeof secretManagerHoneyTokenDetailsByIDPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/$integrationId': typeof secretManagerIntegrationsDetailsByIDPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/select-integration-auth': typeof secretManagerIntegrationsSelectIntegrationAuthPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/secrets/$envSlug': typeof secretManagerSecretDashboardPageRouteRoute
@@ -6416,7 +6397,6 @@ export interface FileRoutesByTo {
'/organizations/$orgId/projects/cert-manager/$projectId/subscribers/$subscriberName': typeof certManagerPkiSubscriberDetailsByIDPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/approvals/$approvalRequestId': typeof pamApprovalRequestDetailPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/sessions/$sessionId': typeof pamPamSessionsByIDPageRouteRoute
- '/organizations/$orgId/projects/secret-management/$projectId/honey-tokens/$honeyTokenId': typeof secretManagerHoneyTokenDetailsByIDPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/$integrationId': typeof secretManagerIntegrationsDetailsByIDPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/select-integration-auth': typeof secretManagerIntegrationsSelectIntegrationAuthPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/secrets/$envSlug': typeof secretManagerSecretDashboardPageRouteRoute
@@ -6705,7 +6685,6 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/subscribers/$subscriberName': typeof certManagerPkiSubscriberDetailsByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/$approvalRequestId': typeof pamApprovalRequestDetailPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/$sessionId': typeof pamPamSessionsByIDPageRouteRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/honey-tokens/$honeyTokenId': typeof secretManagerHoneyTokenDetailsByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/$integrationId': typeof secretManagerIntegrationsDetailsByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/select-integration-auth': typeof secretManagerIntegrationsSelectIntegrationAuthPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/secrets/$envSlug': typeof secretManagerSecretDashboardPageRouteRoute
@@ -6989,7 +6968,6 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/cert-manager/$projectId/subscribers/$subscriberName'
| '/organizations/$orgId/projects/pam/$projectId/approvals/$approvalRequestId'
| '/organizations/$orgId/projects/pam/$projectId/sessions/$sessionId'
- | '/organizations/$orgId/projects/secret-management/$projectId/honey-tokens/$honeyTokenId'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/$integrationId'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/select-integration-auth'
| '/organizations/$orgId/projects/secret-management/$projectId/secrets/$envSlug'
@@ -7249,7 +7227,6 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/cert-manager/$projectId/subscribers/$subscriberName'
| '/organizations/$orgId/projects/pam/$projectId/approvals/$approvalRequestId'
| '/organizations/$orgId/projects/pam/$projectId/sessions/$sessionId'
- | '/organizations/$orgId/projects/secret-management/$projectId/honey-tokens/$honeyTokenId'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/$integrationId'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/select-integration-auth'
| '/organizations/$orgId/projects/secret-management/$projectId/secrets/$envSlug'
@@ -7536,7 +7513,6 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/subscribers/$subscriberName'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approvals/$approvalRequestId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/$sessionId'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/honey-tokens/$honeyTokenId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/$integrationId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/select-integration-auth'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/secrets/$envSlug'
@@ -8236,7 +8212,6 @@ export const routeTree = rootRoute
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/app-connections",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/audit-logs",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/honey-tokens/$honeyTokenId",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/secrets/$envSlug",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/groups/$groupId",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/identities/$identityId",
@@ -8719,10 +8694,6 @@ export const routeTree = rootRoute
"filePath": "pam/PamSessionsByIDPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions"
},
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/honey-tokens/$honeyTokenId": {
- "filePath": "secret-manager/HoneyTokenDetailsByIDPage/route.tsx",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout"
- },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/$integrationId": {
"filePath": "secret-manager/IntegrationsDetailsByIDPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations"
diff --git a/frontend/src/routes.ts b/frontend/src/routes.ts
index 3807abd503..d17988e1ad 100644
--- a/frontend/src/routes.ts
+++ b/frontend/src/routes.ts
@@ -34,7 +34,6 @@ const secretManagerRoutes = route("/organizations/$orgId/projects/secret-managem
)
])
]),
- route("/honey-tokens/$honeyTokenId", "secret-manager/HoneyTokenDetailsByIDPage/route.tsx"),
route("/audit-logs", "project/AuditLogsPage/route-secret-manager.tsx"),
route("/access-management", "project/AccessControlPage/route-secret-manager.tsx"),
route("/app-connections", "project/AppConnectionsPage/route-secret-manager.tsx"),