Skip to content

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

add docs

adilson080346daa2eb
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 0c6f3cda67..9abdded034 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -54,6 +54,7 @@ export enum ApiDocsTags {
DynamicSecrets = "Dynamic Secrets",
SecretImports = "Secret Imports",
SecretRotations = "Secret Rotations",
+ SecretValidationRules = "Secret Validation Rules",
ProxiedServices = "Proxied Services",
IdentitySpecificPrivilegesV1 = "Identity Specific Privileges",
IdentitySpecificPrivilegesV2 = "Identity Specific Privileges V2",
@@ -4038,6 +4039,38 @@ export const SECRET_VALIDATION_RULES = {
dynamicSecretProviders:
"The dynamic secret providers this rule applies to. A lease is only constrained when its provider is listed here.",
secretRotationProviders:
- "The secret rotation providers this rule applies to. A rotation is only constrained when its provider is listed here."
+ "The secret rotation providers this rule applies to. A rotation is only constrained when its provider is listed here.",
+ appliesTo: "What the constraint checks: the secret key, the secret value, or the generated password.",
+ constraintType:
+ "The kind of check this constraint performs, e.g. `min-length`, `regex-pattern`, `required-prefix`.",
+ constraintValue:
+ "The value the constraint is checked against — e.g. the minimum length, the regex pattern, or the required prefix/suffix string."
+ },
+ LIST: {
+ projectId: "The ID of the project to list secret validation rules for."
+ },
+ CREATE: {
+ projectId: "The ID of the project to create the secret validation rule in.",
+ name: "The name of the secret validation rule.",
+ description: "An optional description of the secret validation rule.",
+ environmentSlug:
+ "The slug of the environment this rule is scoped to. Omit to apply the rule to every environment in the project.",
+ secretPath: "The secret path this rule is scoped to.",
+ rule: "The rule configuration: which secret type it targets and the constraints to enforce."
+ },
+ UPDATE: {
+ projectId: "The ID of the project the secret validation rule belongs to.",
+ ruleId: "The ID of the secret validation rule to update.",
+ name: "The name of the secret validation rule.",
+ description: "An optional description of the secret validation rule.",
+ environmentSlug:
+ "The slug of the environment this rule is scoped to. Omit to leave the current scope unchanged; pass `null` to make the rule apply to every environment in the project.",
+ secretPath: "The secret path this rule is scoped to.",
+ rule: "The rule configuration: which secret type it targets and the constraints to enforce. Replaces the existing configuration as a whole — omit to leave it untouched.",
+ isActive: "Whether the secret validation rule is active."
+ },
+ DELETE: {
+ projectId: "The ID of the project the secret validation rule belongs to.",
+ ruleId: "The ID of the secret validation rule to delete."
}
} as const;
diff --git a/backend/src/server/routes/v1/secret-validation-rule-router.ts b/backend/src/server/routes/v1/secret-validation-rule-router.ts
index 98d5970156..2b48b7723d 100644
--- a/backend/src/server/routes/v1/secret-validation-rule-router.ts
+++ b/backend/src/server/routes/v1/secret-validation-rule-router.ts
@@ -1,6 +1,7 @@
import { z } from "zod";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
+import { ApiDocsTags, SECRET_VALIDATION_RULES } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
@@ -19,8 +20,11 @@ export const registerSecretValidationRuleRouter = async (server: FastifyZodProvi
config: { rateLimit: readLimit },
schema: {
hide: false,
+ operationId: "listSecretValidationRules",
+ tags: [ApiDocsTags.SecretValidationRules],
+ description: "List Secret Validation Rules",
params: z.object({
- projectId: z.string().trim()
+ projectId: z.string().trim().describe(SECRET_VALIDATION_RULES.LIST.projectId)
}),
response: {
200: z.object({
@@ -48,15 +52,24 @@ export const registerSecretValidationRuleRouter = async (server: FastifyZodProvi
config: { rateLimit: writeLimit },
schema: {
hide: false,
+ operationId: "createSecretValidationRule",
+ tags: [ApiDocsTags.SecretValidationRules],
+ description: "Create Secret Validation Rule",
params: z.object({
- projectId: z.string().trim()
+ projectId: z.string().trim().describe(SECRET_VALIDATION_RULES.CREATE.projectId)
}),
body: z.object({
- name: z.string().trim().min(1).max(100),
- description: z.string().trim().max(500).nullable().optional(),
- environmentSlug: z.string().trim().min(1).optional(),
- secretPath: z.string().trim().min(1),
- rule: SecretValidationRuleSchema
+ name: z.string().trim().min(1).max(100).describe(SECRET_VALIDATION_RULES.CREATE.name),
+ description: z
+ .string()
+ .trim()
+ .max(500)
+ .nullable()
+ .optional()
+ .describe(SECRET_VALIDATION_RULES.CREATE.description),
+ environmentSlug: z.string().trim().min(1).optional().describe(SECRET_VALIDATION_RULES.CREATE.environmentSlug),
+ secretPath: z.string().trim().min(1).describe(SECRET_VALIDATION_RULES.CREATE.secretPath),
+ rule: SecretValidationRuleSchema.describe(SECRET_VALIDATION_RULES.CREATE.rule)
}),
response: {
200: z.object({
@@ -114,20 +127,35 @@ export const registerSecretValidationRuleRouter = async (server: FastifyZodProvi
config: { rateLimit: writeLimit },
schema: {
hide: false,
+ operationId: "updateSecretValidationRule",
+ tags: [ApiDocsTags.SecretValidationRules],
+ description: "Update Secret Validation Rule",
params: z.object({
- projectId: z.string().trim(),
- ruleId: z.string().uuid()
+ projectId: z.string().trim().describe(SECRET_VALIDATION_RULES.UPDATE.projectId),
+ ruleId: z.string().uuid().describe(SECRET_VALIDATION_RULES.UPDATE.ruleId)
}),
body: z.object({
- name: z.string().trim().min(1).max(100).optional(),
- description: z.string().trim().max(500).nullable().optional(),
- environmentSlug: z.string().trim().min(1).nullable().optional(),
- secretPath: z.string().trim().min(1).optional(),
+ name: z.string().trim().min(1).max(100).optional().describe(SECRET_VALIDATION_RULES.UPDATE.name),
+ description: z
+ .string()
+ .trim()
+ .max(500)
+ .nullable()
+ .optional()
+ .describe(SECRET_VALIDATION_RULES.UPDATE.description),
+ environmentSlug: z
+ .string()
+ .trim()
+ .min(1)
+ .nullable()
+ .optional()
+ .describe(SECRET_VALIDATION_RULES.UPDATE.environmentSlug),
+ secretPath: z.string().trim().min(1).optional().describe(SECRET_VALIDATION_RULES.UPDATE.secretPath),
// The rule config is replaced as a whole when supplied — `type` and the
// per-type fields have to move together for the discriminant to be
// meaningful. Omit it to leave the stored config untouched.
- rule: SecretValidationRuleSchema.optional(),
- isActive: z.boolean().optional()
+ rule: SecretValidationRuleSchema.optional().describe(SECRET_VALIDATION_RULES.UPDATE.rule),
+ isActive: z.boolean().optional().describe(SECRET_VALIDATION_RULES.UPDATE.isActive)
}),
response: {
200: z.object({
@@ -186,9 +214,12 @@ export const registerSecretValidationRuleRouter = async (server: FastifyZodProvi
config: { rateLimit: writeLimit },
schema: {
hide: false,
+ operationId: "deleteSecretValidationRule",
+ tags: [ApiDocsTags.SecretValidationRules],
+ description: "Delete Secret Validation Rule",
params: z.object({
- projectId: z.string().trim(),
- ruleId: z.string().uuid()
+ projectId: z.string().trim().describe(SECRET_VALIDATION_RULES.DELETE.projectId),
+ ruleId: z.string().uuid().describe(SECRET_VALIDATION_RULES.DELETE.ruleId)
}),
response: {
200: z.object({
diff --git a/backend/src/services/secret-validation-rule/secret-validation-rule-schemas.ts b/backend/src/services/secret-validation-rule/secret-validation-rule-schemas.ts
index f80952265b..4d45f9f785 100644
--- a/backend/src/services/secret-validation-rule/secret-validation-rule-schemas.ts
+++ b/backend/src/services/secret-validation-rule/secret-validation-rule-schemas.ts
@@ -29,9 +29,9 @@ const GENERATED_RULE_TARGETS = new Set<ConstraintTarget>([ConstraintTarget.Gener
const GENERATED_RULE_DISALLOWED_CONSTRAINTS = new Set<ConstraintType>([ConstraintType.PreventValueReuse]);
const baseConstraintSchema = z.object({
- type: z.nativeEnum(ConstraintType),
- appliesTo: z.nativeEnum(ConstraintTarget),
- value: z.string()
+ type: z.nativeEnum(ConstraintType).describe(SECRET_VALIDATION_RULES.RULE.constraintType),
+ appliesTo: z.nativeEnum(ConstraintTarget).describe(SECRET_VALIDATION_RULES.RULE.appliesTo),
+ value: z.string().describe(SECRET_VALIDATION_RULES.RULE.constraintValue)
});
const valueRequiredRefinement = (c: z.infer<typeof baseConstraintSchema>) =>
diff --git a/docs/api-reference/endpoints/secret-validation-rules/create.mdx b/docs/api-reference/endpoints/secret-validation-rules/create.mdx
new file mode 100644
index 0000000000..63dc9da4e1
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-validation-rules/create.mdx
@@ -0,0 +1,4 @@
+---
+title: "Create"
+openapi: "POST /api/v1/projects/{projectId}/secret-validation-rules"
+---
diff --git a/docs/api-reference/endpoints/secret-validation-rules/delete.mdx b/docs/api-reference/endpoints/secret-validation-rules/delete.mdx
new file mode 100644
index 0000000000..c9eb1a1090
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-validation-rules/delete.mdx
@@ -0,0 +1,4 @@
+---
+title: "Delete"
+openapi: "DELETE /api/v1/projects/{projectId}/secret-validation-rules/{ruleId}"
+---
diff --git a/docs/api-reference/endpoints/secret-validation-rules/list.mdx b/docs/api-reference/endpoints/secret-validation-rules/list.mdx
new file mode 100644
index 0000000000..83d86c1d74
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-validation-rules/list.mdx
@@ -0,0 +1,4 @@
+---
+title: "List"
+openapi: "GET /api/v1/projects/{projectId}/secret-validation-rules"
+---
diff --git a/docs/api-reference/endpoints/secret-validation-rules/update.mdx b/docs/api-reference/endpoints/secret-validation-rules/update.mdx
new file mode 100644
index 0000000000..60ba18ea2c
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-validation-rules/update.mdx
@@ -0,0 +1,4 @@
+---
+title: "Update"
+openapi: "PATCH /api/v1/projects/{projectId}/secret-validation-rules/{ruleId}"
+---
diff --git a/docs/docs.json b/docs/docs.json
index 959bd1b90a..a5e04ff10a 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -2921,6 +2921,15 @@
}
]
},
+ {
+ "group": "Secret Validation Rules",
+ "pages": [
+ "api-reference/endpoints/secret-validation-rules/list",
+ "api-reference/endpoints/secret-validation-rules/create",
+ "api-reference/endpoints/secret-validation-rules/update",
+ "api-reference/endpoints/secret-validation-rules/delete"
+ ]
+ },
{
"group": "Secret Syncs",
"pages": [