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
improvements: disable user field on update and improve labeling for adding user
Scott Wilsona710126bc4ff
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SnowflakeUserKeyPairRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SnowflakeUserKeyPairRotationParametersFields.tsxindex 5c95d371f6..1549939aa5 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SnowflakeUserKeyPairRotationParametersFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SnowflakeUserKeyPairRotationParametersFields.tsx@@ -10,6 +10,9 @@ import { useSnowflakeConnectionListUsers } from "@app/hooks/api/appConnections/simport { TSnowflakeUser } from "@app/hooks/api/appConnections/snowflake/types";import { SecretRotation } from "@app/hooks/api/secretRotationsV2";+// The create-option row shows its own label ("Add user ...") while the form value stays the raw username.+type TUserOption = TSnowflakeUser & { label?: string };+export const SnowflakeUserKeyPairRotationParametersFields = () => {const { control, watch } = useFormContext<TSecretRotationV2Form & {@@ -18,9 +21,10 @@ export const SnowflakeUserKeyPairRotationParametersFields = () => {>();const connectionId = watch("connection.id");+ const isUpdate = Boolean(watch("id"));const { data: users, isPending: isUsersPending } = useSnowflakeConnectionListUsers(connectionId, {- enabled: Boolean(connectionId)+ enabled: Boolean(connectionId) && !isUpdate});return (@@ -33,39 +37,47 @@ export const SnowflakeUserKeyPairRotationParametersFields = () => {errorText={error?.message}label="User"helperText={- <Tooltip- className="max-w-md"- content={- <>- Select an existing Snowflake user, or type a new username to create it. New users- are created as key-pair-only SERVICE users. Ensure your connection's role has- the privileges to list users, alter the user's RSA public key, and (for new- users) create users. If the keys are rotated the user will continue to exist.- </>- }- >- <div>- <span>Don't see the user you're looking for?</span>{" "}- <FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />- </div>- </Tooltip>+ isUpdate ? (+ "Cannot be updated."+ ) : (+ <Tooltip+ className="max-w-md"+ content={+ <>+ Select an existing Snowflake user, or type a new username to create it. New+ users are created as key-pair-only SERVICE users. Ensure your connection's+ role has the privileges to list users, alter the user's RSA public key, and+ (for new users) create users. If the keys are rotated the user will continue to+ exist.+ </>+ }+ >+ <div>+ <span>Don't see the user you're looking for?</span>{" "}+ <FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />+ </div>+ </Tooltip>+ )}>- <CreatableSelect+ <CreatableSelect<TUserOption>menuPlacement="top"- isLoading={isUsersPending && Boolean(connectionId)}- isDisabled={!connectionId}+ isLoading={isUsersPending && Boolean(connectionId) && !isUpdate}+ isDisabled={!connectionId || isUpdate}value={users?.find((user) => user.name === value) ?? (value ? { name: value } : null)}onChange={(option) => {- const selectedUser = option as SingleValue<TSnowflakeUser>;+ const selectedUser = option as SingleValue<TUserOption>;onChange(selectedUser?.name ?? null);}}onCreateOption={(inputValue) => onChange(inputValue)}- getNewOptionData={(inputValue) => ({ name: inputValue })}+ getNewOptionData={(inputValue) => ({+ name: inputValue,+ label: `Add user "${inputValue}"`+ })}isValidNewOption={(inputValue) => inputValue.trim().length > 0}options={users}- placeholder="Add user..."- getOptionLabel={(option) => option.name}+ placeholder="Select or add a new user..."+ getOptionLabel={(option) => option.label ?? option.name}getOptionValue={(option) => option.name}isClearable/>