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
Address Veria comment
Carlos Monastyrski0f5315eafabb
diff --git a/backend/src/server/routes/v1/hsm-connector-router-schemas.ts b/backend/src/server/routes/v1/hsm-connector-router-schemas.tsindex 051731faf6..5f57ed1084 100644--- a/backend/src/server/routes/v1/hsm-connector-router-schemas.ts+++ b/backend/src/server/routes/v1/hsm-connector-router-schemas.ts@@ -1,10 +1,7 @@import { z } from "zod";import { slugSchema } from "@app/server/lib/schemas";-import {- HsmConnectorCredentialsSchema,- HsmConnectorSanitizedSchema-} from "@app/services/hsm-connector/hsm-connector-fns";+import { HsmConnectorCredentialsSchema } from "@app/services/hsm-connector/hsm-connector-fns";const HSM_CONNECTOR_NAME_MAX = 32;const HSM_CONNECTOR_DESCRIPTION_MAX = 256;diff --git a/backend/src/services/hsm-connector/hsm-connector-service.ts b/backend/src/services/hsm-connector/hsm-connector-service.tsindex da789b6b09..720c967a11 100644--- a/backend/src/services/hsm-connector/hsm-connector-service.ts+++ b/backend/src/services/hsm-connector/hsm-connector-service.ts@@ -248,6 +248,15 @@ export const hsmConnectorServiceFactory = ({await assertGatewayBelongsToOrg(actor.orgId, nextGatewayId, nextGatewayPoolId);}+ const effectiveRoutingChanged =+ (row.gatewayId ?? null) !== nextGatewayId || (row.gatewayPoolId ?? null) !== nextGatewayPoolId;+ if (effectiveRoutingChanged && !dto.credentials?.pin) {+ throw new BadRequestError({+ message:+ "PIN must be re-supplied when changing the Gateway or Gateway Pool of an HSM Connector. Include the new pin in the request body."+ });+ }+const currentCreds = await decryptHsmConnectorCredentials({projectId: row.projectId,encryptedCredentials: row.encryptedCredentials,diff --git a/docs/docs.json b/docs/docs.jsonindex f1f6df7b1f..6a15b3c99e 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -892,7 +892,7 @@]},{- "group": "Certificate Settings",+ "group": "Settings","pages": ["documentation/platform/pki/settings/policies","documentation/platform/pki/settings/profiles",@@ -3386,7 +3386,7 @@]},{- "group": "Certificate Settings",+ "group": "Settings","pages": [{"group": "Certificate Policies",diff --git a/docs/documentation/platform/pki/settings/hsm-connectors-fortanix-dsm.mdx b/docs/documentation/platform/pki/settings/hsm-connectors-fortanix-dsm.mdxindex a32d8f6ffb..a37d1efc68 100644--- a/docs/documentation/platform/pki/settings/hsm-connectors-fortanix-dsm.mdx+++ b/docs/documentation/platform/pki/settings/hsm-connectors-fortanix-dsm.mdx@@ -95,16 +95,16 @@ The **slot label** is your Fortanix group name, visible under **Groups** in the## Troubleshooting<AccordionGroup>- <Accordion title='"slot not found" on Verify'>+ <Accordion title="Verify says the slot can't be found">Confirm the slot label matches what `pkcs11-tool --list-slots` reports. Fortanix slot labels are case-sensitive.</Accordion>- <Accordion title='"login failed" on Verify'>- Re-check the PIN. The PIN must be the same Fortanix API key you put in `pkcs11.conf` (not the DSM account password). If you rotated the API key in the Fortanix dashboard, update both `pkcs11.conf` on the Gateway host and the Connector's PIN in Infisical.+ <Accordion title="Verify says login to the HSM failed">+ Re-check the PIN. It must be the same Fortanix API key you put in `pkcs11.conf` (not the DSM account password). If you rotated the API key in the Fortanix dashboard, update both `pkcs11.conf` on the Gateway host and the Connector's PIN in Infisical.</Accordion>- <Accordion title='"gateway unreachable"'>+ <Accordion title="Verify says the Gateway is unreachable">The Gateway must be running with HSM support enabled. Check the Gateway log for the PKCS#11 module load line.</Accordion>- <Accordion title="Slow operations">+ <Accordion title="Operations through the HSM feel slow">If the Gateway host can't reach DSM over HTTPS with low latency, every sign call pays the round-trip. Run the Gateway in the same network as DSM whenever possible.</Accordion></AccordionGroup>diff --git a/frontend/src/pages/cert-manager/SettingsPage/components/HsmConnectorsTab/EditHsmConnectorSheet.tsx b/frontend/src/pages/cert-manager/SettingsPage/components/HsmConnectorsTab/EditHsmConnectorSheet.tsxindex a0fb47aeda..6d5b0ede25 100644--- a/frontend/src/pages/cert-manager/SettingsPage/components/HsmConnectorsTab/EditHsmConnectorSheet.tsx+++ b/frontend/src/pages/cert-manager/SettingsPage/components/HsmConnectorsTab/EditHsmConnectorSheet.tsx@@ -101,23 +101,41 @@ export const EditHsmConnectorSheet = ({ connector, onClose }: Props) => {}});+ const currentReachedFrom = useMemo(() => {+ if (!connector) return "";+ if (connector.gatewayId) return `gateway:${connector.gatewayId}`;+ if (connector.gatewayPoolId) return `pool:${connector.gatewayPoolId}`;+ return "";+ }, [connector]);+useEffect(() => {if (!connector) return;- let reachedFrom = "";- if (connector.gatewayId) reachedFrom = `gateway:${connector.gatewayId}`;- else if (connector.gatewayPoolId) reachedFrom = `pool:${connector.gatewayPoolId}`;form.reset({name: connector.name,description: connector.description ?? "",- reachedFrom,+ reachedFrom: currentReachedFrom,slotLabel: connector.slotLabel,keyNamePrefix: connector.keyNamePrefix ?? "",pin: ""});- }, [connector, form]);+ }, [connector, currentReachedFrom, form]);++ const watchedReachedFrom = form.watch("reachedFrom");+ const routingChanged =+ Boolean(currentReachedFrom) &&+ Boolean(watchedReachedFrom) &&+ watchedReachedFrom !== currentReachedFrom;const onSubmit = async (values: EditForm) => {if (!connector) return;+ if (routingChanged && !(values.pin && values.pin.length > 0)) {+ form.setError("pin", {+ type: "manual",+ message:+ "Re-enter the PIN to confirm the new Gateway. Reusing the stored PIN against an unverified Gateway would expose it."+ });+ return;+ }const [kind, id] = values.reachedFrom.split(":");const credentialsPatch: Record<string, string> = {};if (values.slotLabel !== connector.slotLabel) credentialsPatch.slotLabel = values.slotLabel;@@ -285,7 +303,9 @@ export const EditHsmConnectorSheet = ({ connector, onClose }: Props) => {control={form.control}render={({ field, fieldState: { error } }) => (<Field>- <FieldLabel>PIN</FieldLabel>+ <FieldLabel>+ PIN {routingChanged && <span className="text-danger">*</span>}+ </FieldLabel><FieldContent><Input{...field}@@ -296,7 +316,9 @@ export const EditHsmConnectorSheet = ({ connector, onClose }: Props) => {isError={Boolean(error)}/><FieldDescription>- Leave blank to keep the current PIN. Type a new value to rotate it.+ {routingChanged+ ? "Required because you are changing the Gateway. Re-enter the PIN so Infisical can verify it against the new route."+ : "Leave blank to keep the current PIN. Type a new value to rotate it."}</FieldDescription><FieldError errors={[error]} /></FieldContent>