Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
improvement(agent-vault): show a cut-off key in full, and copy a value
Scott Wilson12e40b10a92d
diff --git a/docs/documentation/platform/agent-vault/variables.mdx b/docs/documentation/platform/agent-vault/variables.mdxindex 351137b383..508e99747e 100644--- a/docs/documentation/platform/agent-vault/variables.mdx+++ b/docs/documentation/platform/agent-vault/variables.mdx@@ -80,9 +80,11 @@ Infisical encrypts every variable's value. **Secret** only controls whether the- A secret value is hidden (select the eye icon next to the value to reveal it)- A value that isn't secret appears in the list as plain text+To copy a value, open its actions menu and select **Copy Value**. If the value is secret, Infisical copies it without showing it.+The [endpoint that lists variables](/api-reference/endpoints/agent-vault-variables/list) also returns only the values that aren't secret. To read a secret value from the API, call [the endpoint that gets a variable's value](/api-reference/endpoints/agent-vault-variables/get-value).-Infisical writes an audit event each time someone reveals a value, and each time someone creates, updates, or deletes a variable. The events record the key and what changed, but never the value. To review the events, open **Audit Logs** in Agent Vault, or scope an [audit log stream](/documentation/platform/audit-log-streams/audit-log-streams) to the Agent Vault product.+Infisical writes an audit event each time someone reveals or copies a secret value, and each time someone creates, updates, or deletes a variable. The events record the key and what changed, but never the value. To review the events, open **Audit Logs** in Agent Vault, or scope an [audit log stream](/documentation/platform/audit-log-streams/audit-log-streams) to the Agent Vault product.## Double braces in a valuediff --git a/frontend/src/pages/agent-vault/AgentVaultAccessBundleDetailPage/components/VariablesCard.tsx b/frontend/src/pages/agent-vault/AgentVaultAccessBundleDetailPage/components/VariablesCard.tsxindex 84c64c14be..706669399f 100644--- a/frontend/src/pages/agent-vault/AgentVaultAccessBundleDetailPage/components/VariablesCard.tsx+++ b/frontend/src/pages/agent-vault/AgentVaultAccessBundleDetailPage/components/VariablesCard.tsx@@ -1,6 +1,7 @@-import { useMemo, useState } from "react";+import { useMemo, useRef, useState } from "react";import {ChevronDownIcon,+ CopyIcon,EyeIcon,EyeOffIcon,LockIcon,@@ -14,6 +15,7 @@ import { twMerge } from "tailwind-merge";import { ServiceIconStack } from "@app/components/agent-vault/ServiceIconStack";import { VariableFormDialog } from "@app/components/agent-vault/VariableFormDialog";+import { createNotification } from "@app/components/notifications";import {Button,Card,@@ -41,7 +43,10 @@ import {TableCell,TableHead,TableHeader,- TableRow+ TableRow,+ Tooltip,+ TooltipContent,+ TooltipTrigger} from "@app/components/v3";import { toVariableReference } from "@app/helpers/agentVaultVariables";import {@@ -63,6 +68,29 @@ const MASK = "•".repeat(8);// A revealed value is held against the version it was read from, so an edit hides it again.const revealSlot = (variable: TAgentVaultVariable) => `${variable.id}:${variable.updatedAt}`;+// Opens only when the column cuts the key off, measured as it opens.+const TruncatedKey = ({ value }: { value: string }) => {+ const ref = useRef<HTMLSpanElement | null>(null);+ const [isOpen, setIsOpen] = useState(false);++ return (+ <Tooltip+ open={isOpen}+ onOpenChange={(next) => {+ const el = ref.current;+ setIsOpen(next && !!el && el.scrollWidth > el.clientWidth);+ }}+ >+ <TooltipTrigger asChild>+ <span ref={ref} className="block truncate font-mono text-sm">+ {value}+ </span>+ </TooltipTrigger>+ <TooltipContent className="max-w-xs font-mono break-all">{value}</TooltipContent>+ </Tooltip>+ );+};+type Props = {accessBundleId: string;services: TAgentVaultService[];@@ -140,6 +168,24 @@ export const VariablesCard = ({ accessBundleId, services }: Props) => {}};+ // A secret is fetched, and so audited, each time it is copied, and it is never shown. Safari lets a page write+ // the clipboard only inside the click that asked, so the value being fetched goes in as a pending ClipboardItem.+ const copyValue = async (variable: TAgentVaultVariable) => {+ try {+ if (variable.isSecret) {+ const fetched = revealValue+ .mutateAsync({ accessBundleId, variableId: variable.id })+ .then((value) => new Blob([value], { type: "text/plain" }));+ await navigator.clipboard.write([new ClipboardItem({ "text/plain": fetched })]);+ } else {+ await navigator.clipboard.writeText(variable.value ?? "");+ }+ createNotification({ text: `Copied the value of ${variable.key}`, type: "success" });+ } catch {+ // A failed request returns a 4xx that the global request handler surfaces as a toast+ }+ };+const openForm = (variable: TAgentVaultVariable | null) => {setVariableToEdit(variable);setIsFormOpen(true);@@ -241,7 +287,7 @@ export const VariablesCard = ({ accessBundleId, services }: Props) => {return (<TableRow key={variable.id}><TableCell>- <span className="block truncate font-mono text-sm">{variable.key}</span>+ <TruncatedKey value={variable.key} /></TableCell><TableCell>{variable.isSecret ? (@@ -285,6 +331,10 @@ export const VariablesCard = ({ accessBundleId, services }: Props) => {</IconButton></DropdownMenuTrigger><DropdownMenuContent sideOffset={2} align="end">+ <DropdownMenuItem onClick={() => copyValue(variable)}>+ <CopyIcon />+ Copy Value+ </DropdownMenuItem><DropdownMenuItem onClick={() => openForm(variable)}><PencilIcon />Edit