Skip to content

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

fix(agent-vault): always send descriptions, share the control-char rule, document proxy descriptions

Devin AI675b26676e2a
diff --git a/.infisicalignore b/.infisicalignore
index d0bb701fb2..87d57e5ef7 100644
--- a/.infisicalignore
+++ b/.infisicalignore
@@ -81,4 +81,3 @@ frontend/src/pages/secret-scanning/layout.tsx:generic-api-key:9
frontend/src/pages/organization/BillingV2Page/billing-v2-offline-usage.ts:generic-api-key:18
tests/suites/sso/scim/tokens_test.go:jwt:342
frontend/src/hooks/api/appConnections/types/app-options.ts:atlassian-api-token:386
-backend/e2e-test/routes/v1/agent-vault.spec.ts:generic-password:564
diff --git a/docs/documentation/platform/agent-vault/proxies.mdx b/docs/documentation/platform/agent-vault/proxies.mdx
index 7da9e934c6..99a99fdc00 100644
--- a/docs/documentation/platform/agent-vault/proxies.mdx
+++ b/docs/documentation/platform/agent-vault/proxies.mdx
@@ -31,7 +31,7 @@ If an API offers both, configure the agent to use its plain HTTPS requests. Many
In Agent Vault, go to **Proxies** and select **Create Proxy**.
</Step>
<Step>
- Enter a **Name**. To set the [traffic policy](#traffic-policy), [exceptions](#exceptions), or [poll interval](#poll-interval) now, expand **Advanced Options**. You can change these settings later.
+ Enter a **Name**. Optionally, add a **Description**. To set the [traffic policy](#traffic-policy), [exceptions](#exceptions), or [poll interval](#poll-interval) now, expand **Advanced Options**. You can change these settings later.
<Frame>
<img src="/images/platform/agent-vault/proxy-create.png" alt="The Create Proxy dialog with the two traffic policy options and the poll interval" />
diff --git a/frontend/src/components/agent-vault/AccessBundleFormDialog.tsx b/frontend/src/components/agent-vault/AccessBundleFormDialog.tsx
index b6720eb841..3fa101235d 100644
--- a/frontend/src/components/agent-vault/AccessBundleFormDialog.tsx
+++ b/frontend/src/components/agent-vault/AccessBundleFormDialog.tsx
@@ -68,13 +68,10 @@ export const AccessBundleFormDialog = ({
try {
let createdAccessBundle: TAgentVaultAccessBundle | undefined;
if (accessBundle) {
- const nextDescription = description || null;
await updateAccessBundle.mutateAsync({
accessBundleId: accessBundle.id,
name,
- // Sent only when changed, so the update's audit event doesn't read as clearing it.
- description:
- nextDescription !== (accessBundle.description ?? null) ? nextDescription : undefined
+ description: description || null
});
} else {
createdAccessBundle = await createAccessBundle.mutateAsync({
diff --git a/frontend/src/components/agent-vault/PersonalValuesDialog.tsx b/frontend/src/components/agent-vault/PersonalValuesDialog.tsx
index 730ebedec1..7fe050e81d 100644
--- a/frontend/src/components/agent-vault/PersonalValuesDialog.tsx
+++ b/frontend/src/components/agent-vault/PersonalValuesDialog.tsx
@@ -26,6 +26,10 @@ import {
FieldError,
FieldLabel
} from "@app/components/v3";
+import {
+ AGENT_VAULT_NO_CONTROL_CHARS_MESSAGE,
+ AGENT_VAULT_NO_CONTROL_CHARS_RE
+} from "@app/helpers/agentVaultControlChars";
import { findTemplateForHostPattern } from "@app/helpers/agentVaultTemplates";
import {
findVariableReferences,
@@ -54,13 +58,6 @@ import {
import { VariableKeyChips } from "./service-sheet/VariableChips";
import { VariableFormDialog } from "./VariableFormDialog";
-// Mirrors AGENT_VAULT_NO_CONTROL_CHARS_RE on the backend.
-// eslint-disable-next-line no-control-regex
-const NO_CONTROL_CHARS_RE = /^[^\x00-\x1f\x7f]*$/;
-
-const CONTROL_CHARS_MESSAGE =
- "This can't contain line breaks or other control characters. Check for a stray newline if you pasted it.";
-
// The fields reuse the service sheet's secret input, which names them as the sheet does: a token or a basic
// password is `secret`.
type TFormField = "secret" | "username";
@@ -110,7 +107,8 @@ const buildSchema = (
if (!savedFields.has(field)) at("Required");
} else if (value.length > maxLength) {
at(`This can be at most ${maxLength} characters.`);
- } else if (!NO_CONTROL_CHARS_RE.test(value)) at(CONTROL_CHARS_MESSAGE);
+ } else if (!AGENT_VAULT_NO_CONTROL_CHARS_RE.test(value))
+ at(AGENT_VAULT_NO_CONTROL_CHARS_MESSAGE);
else {
// Only once the list has loaded: until then no key can be called missing.
const missingKeys = keys
diff --git a/frontend/src/components/agent-vault/VariableFormDialog.tsx b/frontend/src/components/agent-vault/VariableFormDialog.tsx
index aa07bfca7d..90d8b81464 100644
--- a/frontend/src/components/agent-vault/VariableFormDialog.tsx
+++ b/frontend/src/components/agent-vault/VariableFormDialog.tsx
@@ -25,6 +25,7 @@ import {
InputGroupButton,
InputGroupInput
} from "@app/components/v3";
+import { AGENT_VAULT_NO_CONTROL_CHARS_RE } from "@app/helpers/agentVaultControlChars";
import {
normalizeVariableKey,
toVariableReference,
@@ -47,9 +48,6 @@ import { ApiErrorTypes, TApiErrors } from "@app/hooks/api/types";
// from the key's other errors. The API's duplicate is flagged with it too.
const TAKEN_KEY_ERROR_TYPE = "custom";
-// eslint-disable-next-line no-control-regex
-const NO_CONTROL_CHARS_RE = /^[^\x00-\x1f\x7f]*$/;
-
// A stored value never comes back, so on edit its field starts empty and empty keeps it. Taken keys are read
// when the form validates, as the lookup of the typed key answers after it was typed.
const buildSchema = (
@@ -78,7 +76,7 @@ const buildSchema = (
`A value can be at most ${VARIABLE_VALUE_MAX_LENGTH} characters.`
)
.regex(
- NO_CONTROL_CHARS_RE,
+ AGENT_VAULT_NO_CONTROL_CHARS_RE,
"A value can't contain line breaks or other control characters. Check for a stray newline if you pasted it."
)
.refine((value) => !isValueRequired || value.length > 0, "Required")
diff --git a/frontend/src/components/agent-vault/service-sheet/serviceSchema.ts b/frontend/src/components/agent-vault/service-sheet/serviceSchema.ts
index 98a3717cbf..9973bbc9f5 100644
--- a/frontend/src/components/agent-vault/service-sheet/serviceSchema.ts
+++ b/frontend/src/components/agent-vault/service-sheet/serviceSchema.ts
@@ -1,5 +1,9 @@
import { z } from "zod";
+import {
+ AGENT_VAULT_NO_CONTROL_CHARS_MESSAGE,
+ AGENT_VAULT_NO_CONTROL_CHARS_RE
+} from "@app/helpers/agentVaultControlChars";
import { addHostIssues, hostError } from "@app/helpers/agentVaultHostPattern";
import { addPathPrefixIssues, pathPrefixError } from "@app/helpers/agentVaultPathPrefix";
import { variableReferenceError } from "@app/helpers/agentVaultVariables";
@@ -138,14 +142,6 @@ export const SURFACE_LABELS: Record<AgentVaultSubstitutionSurface, string> = {
[AgentVaultSubstitutionSurface.Body]: "Body"
};
-// Mirrors AGENT_VAULT_NO_CONTROL_CHARS_RE on the backend. A pasted key with a trailing newline is the
-// common case, and it saves fine but then makes Go refuse to send the header.
-// eslint-disable-next-line no-control-regex
-const NO_CONTROL_CHARS_RE = /^[^\x00-\x1f\x7f]*$/;
-
-const CONTROL_CHARS_MESSAGE =
- "This can't contain line breaks or other control characters. Check for a stray newline if you pasted it.";
-
// Double braces wrap a variable reference, and neither a prefix nor a placeholder takes one.
// The client ID and secret go to the provider as typed, unlike the credential fields that take `{{KEY}}`.
export const OAUTH_CLIENT_VARIABLES_MESSAGE = "Variables aren't supported here. Paste the value.";
@@ -520,10 +516,12 @@ export const buildServiceSchema = (
seenHeaders.add(header.name.toLowerCase());
if (!header.value) at("value", "Required");
- else if (!NO_CONTROL_CHARS_RE.test(header.value)) at("value", CONTROL_CHARS_MESSAGE);
+ // A pasted key with a trailing newline saves fine but then makes Go refuse to send the header.
+ else if (!AGENT_VAULT_NO_CONTROL_CHARS_RE.test(header.value))
+ at("value", AGENT_VAULT_NO_CONTROL_CHARS_MESSAGE);
- if (header.prefix && !NO_CONTROL_CHARS_RE.test(header.prefix)) {
- at("prefix", CONTROL_CHARS_MESSAGE);
+ if (header.prefix && !AGENT_VAULT_NO_CONTROL_CHARS_RE.test(header.prefix)) {
+ at("prefix", AGENT_VAULT_NO_CONTROL_CHARS_MESSAGE);
} else if (header.prefix && hasDoubleBraces(header.prefix)) {
at("prefix", PREFIX_BRACES_MESSAGE);
}
@@ -540,8 +538,8 @@ export const buildServiceSchema = (
if (!substitution.placeholder) {
at("placeholder", "Required");
- } else if (!NO_CONTROL_CHARS_RE.test(substitution.placeholder)) {
- at("placeholder", CONTROL_CHARS_MESSAGE);
+ } else if (!AGENT_VAULT_NO_CONTROL_CHARS_RE.test(substitution.placeholder)) {
+ at("placeholder", AGENT_VAULT_NO_CONTROL_CHARS_MESSAGE);
} else if (hasDoubleBraces(substitution.placeholder)) {
at(
"placeholder",
@@ -553,7 +551,8 @@ export const buildServiceSchema = (
seenPlaceholders.add(substitution.placeholder);
if (!substitution.value) at("value", "Required");
- else if (!NO_CONTROL_CHARS_RE.test(substitution.value)) at("value", CONTROL_CHARS_MESSAGE);
+ else if (!AGENT_VAULT_NO_CONTROL_CHARS_RE.test(substitution.value))
+ at("value", AGENT_VAULT_NO_CONTROL_CHARS_MESSAGE);
if (substitution.surfaces.length === 0) {
at("surfaces", "Pick at least one place to look for the placeholder.");
}
diff --git a/frontend/src/helpers/agentVaultControlChars.ts b/frontend/src/helpers/agentVaultControlChars.ts
new file mode 100644
index 0000000000..dd1bfaabf3
--- /dev/null
+++ b/frontend/src/helpers/agentVaultControlChars.ts
@@ -0,0 +1,6 @@
+// Mirrors AGENT_VAULT_NO_CONTROL_CHARS_RE on the backend.
+// eslint-disable-next-line no-control-regex
+export const AGENT_VAULT_NO_CONTROL_CHARS_RE = /^[^\x00-\x1f\x7f]*$/;
+
+export const AGENT_VAULT_NO_CONTROL_CHARS_MESSAGE =
+ "This can't contain line breaks or other control characters. Check for a stray newline if you pasted it.";
diff --git a/frontend/src/helpers/agentVaultDescription.ts b/frontend/src/helpers/agentVaultDescription.ts
index 9028dbea7d..bcf335e0f6 100644
--- a/frontend/src/helpers/agentVaultDescription.ts
+++ b/frontend/src/helpers/agentVaultDescription.ts
@@ -1,14 +1,14 @@
import { z } from "zod";
-// Mirrors AgentVaultDescriptionSchema on the backend, messages included.
-// eslint-disable-next-line no-control-regex
-const NO_CONTROL_CHARS_RE = /^[^\x00-\x1f\x7f]*$/;
+import {
+ AGENT_VAULT_NO_CONTROL_CHARS_MESSAGE,
+ AGENT_VAULT_NO_CONTROL_CHARS_RE
+} from "@app/helpers/agentVaultControlChars";
+
+// Mirrors AgentVaultDescriptionSchema on the backend's rules and messages. Callers map a blank description to null.
export const agentVaultDescriptionSchema = z
.string()
.trim()
.max(256, "A description can be at most 256 characters")
- .regex(
- NO_CONTROL_CHARS_RE,
- "This can't contain line breaks or other control characters. Check for a stray newline if you pasted it."
- );
+ .regex(AGENT_VAULT_NO_CONTROL_CHARS_RE, AGENT_VAULT_NO_CONTROL_CHARS_MESSAGE);
diff --git a/frontend/src/pages/agent-vault/AgentVaultProxiesPage/components/ProxyFormDialog.tsx b/frontend/src/pages/agent-vault/AgentVaultProxiesPage/components/ProxyFormDialog.tsx
index a5555d7e89..93b6342a49 100644
--- a/frontend/src/pages/agent-vault/AgentVaultProxiesPage/components/ProxyFormDialog.tsx
+++ b/frontend/src/pages/agent-vault/AgentVaultProxiesPage/components/ProxyFormDialog.tsx
@@ -176,12 +176,10 @@ export const ProxyFormDialog = ({ isOpen, onOpenChange, proxy, onCreated }: Prop
};
if (proxy) {
- const description = data.description || null;
await updateProxy.mutateAsync({
proxyId: proxy.id,
...payload,
- // Sent only when changed, so the update's audit event doesn't read as clearing it.
- description: description !== (proxy.description ?? null) ? description : undefined
+ description: data.description || null
});
createNotification({ text: `Proxy "${data.name}" updated`, type: "success" });
} else {