mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 18:27:19 +00:00
misc: final revisions
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
import RE2 from "re2";
|
import RE2 from "re2";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
|
import { CharacterType, characterValidator } from "@app/lib/validator/validate-string";
|
||||||
|
|
||||||
import { TDynamicSecretLeaseConfig } from "../../dynamic-secret-lease/dynamic-secret-lease-types";
|
import { TDynamicSecretLeaseConfig } from "../../dynamic-secret-lease/dynamic-secret-lease-types";
|
||||||
|
|
||||||
export type PasswordRequirements = {
|
export type PasswordRequirements = {
|
||||||
@@ -341,7 +343,11 @@ export const DynamicSecretKubernetesSchema = z
|
|||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
.min(1)
|
.min(1)
|
||||||
.refine((val) => !val.includes(","), "Namespace must be a single value, not a comma-separated list"),
|
.refine((val) => !val.includes(","), "Namespace must be a single value, not a comma-separated list")
|
||||||
|
.refine(
|
||||||
|
(val) => characterValidator([CharacterType.AlphaNumeric, CharacterType.Hyphen])(val),
|
||||||
|
"Invalid namespace format"
|
||||||
|
),
|
||||||
gatewayId: z.string().optional(),
|
gatewayId: z.string().optional(),
|
||||||
audiences: z.array(z.string().trim().min(1)),
|
audiences: z.array(z.string().trim().min(1)),
|
||||||
authMethod: z.nativeEnum(KubernetesAuthMethod).default(KubernetesAuthMethod.Api)
|
authMethod: z.nativeEnum(KubernetesAuthMethod).default(KubernetesAuthMethod.Api)
|
||||||
@@ -364,7 +370,11 @@ export const DynamicSecretKubernetesSchema = z
|
|||||||
.min(1)
|
.min(1)
|
||||||
.refine((val) => {
|
.refine((val) => {
|
||||||
const namespaces = val.split(",").map((ns) => ns.trim());
|
const namespaces = val.split(",").map((ns) => ns.trim());
|
||||||
return namespaces.length > 0 && namespaces.every((ns) => ns.length > 0);
|
return (
|
||||||
|
namespaces.length > 0 &&
|
||||||
|
namespaces.every((ns) => ns.length > 0) &&
|
||||||
|
namespaces.every((ns) => characterValidator([CharacterType.AlphaNumeric, CharacterType.Hyphen])(ns))
|
||||||
|
);
|
||||||
}, "Must be a valid comma-separated list of namespace values"),
|
}, "Must be a valid comma-separated list of namespace values"),
|
||||||
gatewayId: z.string().optional(),
|
gatewayId: z.string().optional(),
|
||||||
audiences: z.array(z.string().trim().min(1)),
|
audiences: z.array(z.string().trim().min(1)),
|
||||||
|
|||||||
+7
-1
@@ -211,7 +211,13 @@ export const KubernetesInputForm = ({
|
|||||||
try {
|
try {
|
||||||
const isDefaultUsernameTemplate = usernameTemplate === "{{randomUsername}}";
|
const isDefaultUsernameTemplate = usernameTemplate === "{{randomUsername}}";
|
||||||
await createDynamicSecret.mutateAsync({
|
await createDynamicSecret.mutateAsync({
|
||||||
provider: { type: DynamicSecretProviders.Kubernetes, inputs: provider },
|
provider: {
|
||||||
|
type: DynamicSecretProviders.Kubernetes,
|
||||||
|
inputs: {
|
||||||
|
...provider,
|
||||||
|
url: provider.url || undefined
|
||||||
|
}
|
||||||
|
},
|
||||||
maxTTL: rest.maxTTL,
|
maxTTL: rest.maxTTL,
|
||||||
name: rest.name,
|
name: rest.name,
|
||||||
path: secretPath,
|
path: secretPath,
|
||||||
|
|||||||
+4
-1
@@ -201,7 +201,10 @@ export const EditDynamicSecretKubernetesForm = ({
|
|||||||
projectSlug,
|
projectSlug,
|
||||||
environmentSlug: environment,
|
environmentSlug: environment,
|
||||||
data: {
|
data: {
|
||||||
inputs: formData.inputs,
|
inputs: {
|
||||||
|
...formData.inputs,
|
||||||
|
url: formData.inputs.url || undefined
|
||||||
|
},
|
||||||
newName: formData.newName === dynamicSecret.name ? undefined : formData.newName,
|
newName: formData.newName === dynamicSecret.name ? undefined : formData.newName,
|
||||||
defaultTTL: formData.defaultTTL,
|
defaultTTL: formData.defaultTTL,
|
||||||
maxTTL: formData.maxTTL,
|
maxTTL: formData.maxTTL,
|
||||||
|
|||||||
Reference in New Issue
Block a user