Skip to content

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

view details drawer

Matheus Nogueira79b334eddecb
diff --git a/frontend/src/components/honey-tokens/HoneyTokenDetailsDrawer.tsx b/frontend/src/components/honey-tokens/HoneyTokenDetailsDrawer.tsx
new file mode 100644
index 0000000000..9358e012f0
--- /dev/null
+++ b/frontend/src/components/honey-tokens/HoneyTokenDetailsDrawer.tsx
@@ -0,0 +1,454 @@
+import { useEffect, useReducer, useState } from "react";
+import { format, formatDistanceToNow } from "date-fns";
+import {
+ AlertTriangle,
+ BanIcon,
+ CalendarIcon,
+ Check,
+ ClipboardCopy,
+ ClockIcon,
+ EyeOff,
+ HexagonIcon,
+ KeyIcon,
+ MapPinIcon,
+ RotateCcw
+} from "lucide-react";
+
+import { createNotification } from "@app/components/notifications";
+import { ProjectPermissionCan } from "@app/components/permissions";
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogMedia,
+ AlertDialogTitle,
+ Badge,
+ Button,
+ Field,
+ FieldContent,
+ FieldLabel,
+ IconButton,
+ Input,
+ PageLoader,
+ Sheet,
+ SheetContent,
+ SheetHeader,
+ SheetTitle,
+ Skeleton,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
+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 "@app/pages/secret-manager/HoneyTokenDetailsByIDPage/components";
+
+type Props = {
+ isOpen: boolean;
+ onOpenChange: (isOpen: boolean) => void;
+ honeyTokenId: string;
+ projectId: string;
+};
+
+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 DrawerContent = ({
+ honeyTokenId,
+ projectId
+}: {
+ honeyTokenId: string;
+ projectId: string;
+}) => {
+ 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 p-8">
+ <PageLoader />
+ </div>
+ );
+ }
+
+ if (!honeyToken) {
+ return <div className="p-4 text-center text-sm text-muted">Could not find honey token.</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 (
+ <>
+ <div className="flex flex-col gap-4 p-4">
+ <div className="flex items-start justify-between">
+ <div className="flex items-center gap-3">
+ {tokenInfo && (
+ <img
+ src={`/images/integrations/${tokenInfo.image}`}
+ className="h-10 w-10 shrink-0"
+ alt={`${tokenInfo.name} logo`}
+ />
+ )}
+ <div className="min-w-0">
+ <div className="flex flex-wrap items-center gap-2">
+ <p className="truncate font-medium">{honeyToken.name}</p>
+ <Badge variant={statusBadgeVariant}>
+ {isTriggered && <AlertTriangle size={12} className="mr-1" />}
+ {statusLabel}
+ </Badge>
+ </div>
+ <p className="text-xs text-muted">
+ {honeyToken.description || `${tokenInfo?.name ?? "Honey"} Token`}
+ </p>
+ </div>
+ </div>
+ </div>
+
+ <div className="flex 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 className="flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-border pt-4 text-xs text-muted">
+ <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="border-t border-border pt-4">
+ <div className="mb-2 flex items-center gap-1.5 text-xs text-muted">
+ <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-muted">No credentials available.</p>
+ )}
+ </div>
+ )
+ }
+ </ProjectPermissionCan>
+ )}
+
+ {isRevoked && (
+ <div className="rounded-md border border-border bg-container p-4">
+ <div className="mb-2 flex items-center gap-2">
+ <BanIcon size={16} className="text-muted" />
+ <p className="text-sm font-medium text-muted">Honey token revoked</p>
+ </div>
+ <p className="text-xs text-muted">
+ 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="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-muted">
+ Investigate. The events below give you information about when, where, and how the key
+ was used.
+ </p>
+ <div className="flex flex-col gap-4">
+ <div>
+ <p className="text-xs font-medium">1. False alarm confirmed?</p>
+ <p className="text-xs text-muted">
+ 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>
+ <p className="text-xs font-medium">2. Malicious activity confirmed?</p>
+ <p className="text-xs text-muted">
+ 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>
+ )}
+
+ <HoneyTokenEventsSection honeyTokenId={honeyTokenId} projectId={projectId} />
+ </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 HoneyTokenDetailsDrawer = ({
+ isOpen,
+ onOpenChange,
+ honeyTokenId,
+ projectId
+}: Props) => {
+ return (
+ <Sheet open={isOpen} onOpenChange={onOpenChange}>
+ <SheetContent className="flex h-full flex-col gap-y-0 overflow-y-auto sm:max-w-3xl">
+ <SheetHeader className="border-b">
+ <SheetTitle>Honey Token Details</SheetTitle>
+ </SheetHeader>
+ {isOpen && honeyTokenId && (
+ <DrawerContent honeyTokenId={honeyTokenId} projectId={projectId} />
+ )}
+ </SheetContent>
+ </Sheet>
+ );
+};
diff --git a/frontend/src/components/honey-tokens/index.ts b/frontend/src/components/honey-tokens/index.ts
index 32bf385bd3..490e13dd17 100644
--- a/frontend/src/components/honey-tokens/index.ts
+++ b/frontend/src/components/honey-tokens/index.ts
@@ -1,4 +1,5 @@
export * from "./CreateHoneyTokenModal";
export * from "./EditHoneyTokenModal";
+export * from "./HoneyTokenDetailsDrawer";
export * from "./RevokeHoneyTokenModal";
export * from "./ViewHoneyTokenCredentialsModal";
diff --git a/frontend/src/pages/secret-manager/HoneyTokenDetailsByIDPage/components/HoneyTokenEventsSection.tsx b/frontend/src/pages/secret-manager/HoneyTokenDetailsByIDPage/components/HoneyTokenEventsSection.tsx
index 451c33d2f2..747aa9208d 100644
--- a/frontend/src/pages/secret-manager/HoneyTokenDetailsByIDPage/components/HoneyTokenEventsSection.tsx
+++ b/frontend/src/pages/secret-manager/HoneyTokenDetailsByIDPage/components/HoneyTokenEventsSection.tsx
@@ -1,18 +1,26 @@
import { useState } from "react";
import { format, formatDistanceToNow } from "date-fns";
-import { ActivityIcon } from "lucide-react";
+import { ActivityIcon, Check, ClipboardCopy } from "lucide-react";
import {
Badge,
Empty,
EmptyHeader,
EmptyTitle,
+ IconButton,
PageLoader,
Pagination,
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
Tooltip,
TooltipContent,
TooltipTrigger
} from "@app/components/v3";
+import { useTimedReset } from "@app/hooks";
import { useGetHoneyTokenEvents } from "@app/hooks/api/honeyTokens/queries";
type Props = {
@@ -22,6 +30,32 @@ type Props = {
const DEFAULT_PER_PAGE = 25;
+const UserAgentCell = ({ userAgent }: { userAgent?: string }) => {
+ const [, isCopied, setCopied] = useTimedReset<string>({ initialState: "" });
+
+ if (!userAgent) return <TableCell>—</TableCell>;
+
+ return (
+ <TableCell className="max-w-[150px]" isTruncatable>
+ <div className="flex items-center gap-1">
+ <span className="block truncate">{userAgent}</span>
+ <IconButton
+ variant="ghost"
+ size="xs"
+ className="shrink-0"
+ onClick={() => {
+ setCopied(userAgent);
+ navigator.clipboard.writeText(userAgent);
+ }}
+ aria-label="Copy user agent"
+ >
+ {isCopied ? <Check className="size-3" /> : <ClipboardCopy className="size-3" />}
+ </IconButton>
+ </div>
+ </TableCell>
+ );
+};
+
export const HoneyTokenEventsSection = ({ honeyTokenId, projectId }: Props) => {
const [page, setPage] = useState(1);
const [perPage, setPerPage] = useState(DEFAULT_PER_PAGE);
@@ -37,14 +71,14 @@ export const HoneyTokenEventsSection = ({ honeyTokenId, projectId }: Props) => {
const totalCount = data?.totalCount ?? 0;
return (
- <div className="rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-6">
+ <div>
<div className="mb-4 flex items-center gap-2">
- <ActivityIcon size={16} className="text-bunker-300" />
- <p className="text-sm font-medium text-white">Events</p>
+ <ActivityIcon size={16} className="text-muted" />
+ <p className="text-sm font-medium">Events</p>
{totalCount > 0 && (
- <span className="rounded-full bg-mineshaft-600 px-2 py-0.5 text-xs text-bunker-300">
+ <Badge variant="neutral" className="text-xs">
{totalCount}
- </span>
+ </Badge>
)}
</div>
@@ -59,77 +93,60 @@ export const HoneyTokenEventsSection = ({ honeyTokenId, projectId }: Props) => {
)}
{events && events.length > 0 && (
- <>
- <div className="overflow-x-auto">
- <table className="w-full text-left text-sm">
- <thead>
- <tr className="border-b border-mineshaft-600 text-xs text-bunker-300 uppercase">
- <th className="px-3 py-2">Timestamp</th>
- <th className="px-3 py-2">Action</th>
- <th className="px-3 py-2">Region</th>
- <th className="px-3 py-2">IP address</th>
- <th className="px-3 py-2">User agent</th>
- </tr>
- </thead>
- <tbody>
- {events.map((event) => {
- const meta = event.metadata;
- const eventDate = meta?.eventTime
- ? new Date(meta.eventTime)
- : new Date(event.createdAt);
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>Timestamp</TableHead>
+ <TableHead>Action</TableHead>
+ <TableHead>Region</TableHead>
+ <TableHead>IP Address</TableHead>
+ <TableHead>User Agent</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {events.map((event) => {
+ const meta = event.metadata;
+ const eventDate = meta?.eventTime
+ ? new Date(meta.eventTime)
+ : new Date(event.createdAt);
- return (
- <tr
- key={event.id}
- className="border-b border-mineshaft-700 text-sm text-white last:border-0"
- >
- <td className="px-3 py-3 whitespace-nowrap text-bunker-300">
- <Tooltip>
- <TooltipTrigger asChild>
- <span>{formatDistanceToNow(eventDate, { addSuffix: true })}</span>
- </TooltipTrigger>
- <TooltipContent>
- {format(eventDate, "MMMM do, yyyy 'at' h:mm:ss a")}
- </TooltipContent>
- </Tooltip>
- </td>
- <td className="px-3 py-3">
- {meta?.eventName ? <Badge variant="neutral">{meta.eventName}</Badge> : "—"}
- </td>
- <td className="px-3 py-3 whitespace-nowrap text-bunker-300">
- {meta?.awsRegion ?? "—"}
- </td>
- <td className="px-3 py-3 text-bunker-300">{meta?.sourceIp ?? "—"}</td>
- <td className="max-w-[300px] px-3 py-3 text-bunker-300">
- <Tooltip>
- <TooltipTrigger asChild>
- <span className="block truncate">{meta?.userAgent ?? "—"}</span>
- </TooltipTrigger>
- <TooltipContent>{meta?.userAgent}</TooltipContent>
- </Tooltip>
- </td>
- </tr>
- );
- })}
- </tbody>
- </table>
- </div>
- {totalCount > DEFAULT_PER_PAGE && (
- <Pagination
- count={totalCount}
- page={page}
- perPage={perPage}
- onChangePage={setPage}
- onChangePerPage={(newPerPage) => {
- const totalPages = Math.ceil(totalCount / newPerPage);
- if (page > totalPages) setPage(totalPages);
- setPerPage(newPerPage);
- }}
- perPageList={[25, 50, 100]}
- />
- )}
- </>
+ return (
+ <TableRow key={event.id}>
+ <TableCell className="whitespace-nowrap">
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span>{formatDistanceToNow(eventDate, { addSuffix: true })}</span>
+ </TooltipTrigger>
+ <TooltipContent>
+ {format(eventDate, "MMMM do, yyyy 'at' h:mm:ss a")}
+ </TooltipContent>
+ </Tooltip>
+ </TableCell>
+ <TableCell>
+ {meta?.eventName ? <Badge variant="neutral">{meta.eventName}</Badge> : "—"}
+ </TableCell>
+ <TableCell className="whitespace-nowrap">{meta?.awsRegion ?? "—"}</TableCell>
+ <TableCell>{meta?.sourceIp ?? "—"}</TableCell>
+ <UserAgentCell userAgent={meta?.userAgent} />
+ </TableRow>
+ );
+ })}
+ </TableBody>
+ </Table>
)}
+
+ <Pagination
+ count={totalCount}
+ page={page}
+ perPage={perPage}
+ onChangePage={setPage}
+ onChangePerPage={(newPerPage) => {
+ const totalPages = Math.ceil(totalCount / newPerPage);
+ if (page > totalPages) setPage(totalPages);
+ setPerPage(newPerPage);
+ }}
+ perPageList={[25, 50, 100]}
+ />
</div>
);
};
diff --git a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
index 5222e433a4..9e2bfb1e3f 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
@@ -27,6 +27,7 @@ import { twMerge } from "tailwind-merge";
import {
CreateHoneyTokenModal,
EditHoneyTokenModal,
+ HoneyTokenDetailsDrawer,
RevokeHoneyTokenModal,
ViewHoneyTokenCredentialsModal
} from "@app/components/honey-tokens";
@@ -784,7 +785,8 @@ const OverviewPageContent = () => {
"confirmDisableBatchMode",
"editHoneyToken",
"revokeHoneyToken",
- "viewHoneyTokenCredentials"
+ "viewHoneyTokenCredentials",
+ "viewHoneyTokenDetails"
] as const);
// Auto-open dynamic secret leases modal when linked via notification/email
@@ -3101,6 +3103,9 @@ const OverviewPageContent = () => {
onViewCredentials={(honeyToken) =>
handlePopUpOpen("viewHoneyTokenCredentials", honeyToken)
}
+ onViewDetails={(honeyToken) =>
+ handlePopUpOpen("viewHoneyTokenDetails", honeyToken)
+ }
/>
))}
{mergedSecKeys.map((key, index) => (
@@ -3456,6 +3461,12 @@ const OverviewPageContent = () => {
projectId={projectId}
onOpenChange={(isOpen) => handlePopUpToggle("viewHoneyTokenCredentials", isOpen)}
/>
+ <HoneyTokenDetailsDrawer
+ isOpen={popUp.viewHoneyTokenDetails.isOpen}
+ honeyTokenId={(popUp.viewHoneyTokenDetails.data as TDashboardHoneyToken)?.id ?? ""}
+ projectId={projectId}
+ onOpenChange={(isOpen) => handlePopUpToggle("viewHoneyTokenDetails", isOpen)}
+ />
<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 4e97c446c5..675b8ce564 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/HoneyTokenTableRow/HoneyTokenTableRow.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/HoneyTokenTableRow/HoneyTokenTableRow.tsx
@@ -1,12 +1,11 @@
-import { useNavigate, useParams } from "@tanstack/react-router";
import {
AsteriskIcon,
BanIcon,
ChevronDownIcon,
EditIcon,
ExternalLinkIcon,
- InfoIcon,
- HexagonIcon
+ HexagonIcon,
+ InfoIcon
} from "lucide-react";
import { twMerge } from "tailwind-merge";
@@ -24,7 +23,6 @@ import {
TooltipContent,
TooltipTrigger
} from "@app/components/v3";
-import { ROUTE_PATHS } from "@app/const/routes";
import {
ProjectPermissionSecretActions,
ProjectPermissionSub
@@ -51,6 +49,7 @@ type Props = {
onEdit: (honeyToken: TDashboardHoneyToken) => void;
onRevoke: (honeyToken: TDashboardHoneyToken) => void;
onViewCredentials: (honeyToken: TDashboardHoneyToken) => void;
+ onViewDetails: (honeyToken: TDashboardHoneyToken) => void;
};
export const HoneyTokenTableRow = ({
@@ -61,12 +60,9 @@ export const HoneyTokenTableRow = ({
tableWidth,
onEdit,
onRevoke,
- onViewCredentials
+ onViewCredentials,
+ onViewDetails
}: Props) => {
- const navigate = useNavigate();
- const { orgId, projectId } = useParams({
- from: ROUTE_PATHS.SecretManager.OverviewPage.id
- });
const [isExpanded, setIsExpanded] = useToggle(false);
const isSingleEnvView = environments.length === 1;
@@ -102,12 +98,7 @@ export const HoneyTokenTableRow = ({
variant="ghost"
size="xs"
className="w-0 overflow-hidden border-0 transition-all duration-300 group-hover:w-7"
- onClick={() =>
- navigate({
- to: ROUTE_PATHS.SecretManager.HoneyTokenDetailsByIDPage.path,
- params: { orgId, projectId, honeyTokenId: honeyToken.id }
- })
- }
+ onClick={() => onViewDetails(honeyToken)}
>
<ExternalLinkIcon />
</IconButton>
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/HoneyTokenListView/HoneyTokenItem.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/HoneyTokenListView/HoneyTokenItem.tsx
index 9eee55b456..a76276853e 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/HoneyTokenListView/HoneyTokenItem.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/HoneyTokenListView/HoneyTokenItem.tsx
@@ -1,19 +1,17 @@
import { useState } from "react";
-import { useNavigate, useParams } from "@tanstack/react-router";
import { AnimatePresence, motion } from "framer-motion";
import {
AsteriskIcon,
BanIcon,
ExternalLinkIcon,
+ HexagonIcon,
InfoIcon,
- PencilIcon,
- HexagonIcon
+ PencilIcon
} from "lucide-react";
import { twMerge } from "tailwind-merge";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Badge, IconButton, 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_MAP } from "@app/helpers/honeyTokens";
@@ -25,13 +23,16 @@ type Props = {
onEdit: () => void;
onRevoke: () => void;
onViewCredentials: () => void;
+ onViewDetails: () => void;
};
-export const HoneyTokenItem = ({ honeyToken, onEdit, onRevoke, onViewCredentials }: Props) => {
- const navigate = useNavigate();
- const { orgId, projectId } = useParams({
- from: ROUTE_PATHS.SecretManager.SecretDashboardPage.id
- });
+export const HoneyTokenItem = ({
+ honeyToken,
+ onEdit,
+ onRevoke,
+ onViewCredentials,
+ onViewDetails
+}: Props) => {
const { name, type, status, secretsMapping } = honeyToken;
const [isExpanded, setIsExpanded] = useState(true);
@@ -120,10 +121,7 @@ export const HoneyTokenItem = ({ honeyToken, onEdit, onRevoke, onViewCredentials
className="opacity-0 group-hover:opacity-100"
onClick={(e) => {
e.stopPropagation();
- navigate({
- to: ROUTE_PATHS.SecretManager.HoneyTokenDetailsByIDPage.path,
- params: { orgId, projectId, honeyTokenId: honeyToken.id }
- });
+ onViewDetails();
}}
>
<ExternalLinkIcon className="size-4" />
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 978ef49654..ecd8f02f94 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/HoneyTokenListView/HoneyTokenListView.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/HoneyTokenListView/HoneyTokenListView.tsx
@@ -2,6 +2,7 @@ import { useState } from "react";
import {
EditHoneyTokenModal,
+ HoneyTokenDetailsDrawer,
RevokeHoneyTokenModal,
ViewHoneyTokenCredentialsModal
} from "@app/components/honey-tokens";
@@ -20,6 +21,7 @@ export const HoneyTokenListView = ({ honeyTokens }: Props) => {
const [revokeTarget, setRevokeTarget] = useState<TDashboardHoneyToken>();
const [editTarget, setEditTarget] = useState<TDashboardHoneyToken>();
const [credentialsTarget, setCredentialsTarget] = useState<TDashboardHoneyToken>();
+ const [detailsTarget, setDetailsTarget] = useState<TDashboardHoneyToken>();
return (
<>
@@ -30,6 +32,7 @@ export const HoneyTokenListView = ({ honeyTokens }: Props) => {
onEdit={() => setEditTarget(honeyToken)}
onRevoke={() => setRevokeTarget(honeyToken)}
onViewCredentials={() => setCredentialsTarget(honeyToken)}
+ onViewDetails={() => setDetailsTarget(honeyToken)}
/>
))}
<EditHoneyTokenModal
@@ -54,6 +57,14 @@ export const HoneyTokenListView = ({ honeyTokens }: Props) => {
honeyToken={credentialsTarget}
projectId={projectId}
/>
+ <HoneyTokenDetailsDrawer
+ isOpen={Boolean(detailsTarget)}
+ onOpenChange={(isOpen) => {
+ if (!isOpen) setDetailsTarget(undefined);
+ }}
+ honeyTokenId={detailsTarget?.id ?? ""}
+ projectId={projectId}
+ />
</>
);
};