feat: resolved trailing slash in secret paths

This commit is contained in:
Akhil Mohan
2024-01-29 00:21:42 +05:30
parent f010a3a932
commit 4e20735f98
10 changed files with 75 additions and 44 deletions
+3 -2
View File
@@ -2,6 +2,7 @@ import { z } from "zod";
import { AuditLogsSchema, SecretSnapshotsSchema } from "@app/db/schemas";
import { EventType, UserAgentType } from "@app/ee/services/audit-log/audit-log-types";
import { removeTrailingSlash } from "@app/lib/fn";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
@@ -15,7 +16,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
}),
querystring: z.object({
environment: z.string().trim(),
path: z.string().trim().default("/"),
path: z.string().trim().default("/").transform(removeTrailingSlash),
offset: z.coerce.number().default(0),
limit: z.coerce.number().default(20)
}),
@@ -46,7 +47,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
}),
querystring: z.object({
environment: z.string().trim(),
path: z.string().trim().default("/")
path: z.string().trim().default("/").transform(removeTrailingSlash)
}),
response: {
200: z.object({
@@ -1,6 +1,7 @@
import { z } from "zod";
import { SecretRotationOutputsSchema, SecretRotationsSchema, SecretsSchema } from "@app/db/schemas";
import { removeTrailingSlash } from "@app/lib/fn";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
@@ -11,7 +12,7 @@ export const registerSecretRotationRouter = async (server: FastifyZodProvider) =
schema: {
body: z.object({
workspaceId: z.string().trim(),
secretPath: z.string().trim(),
secretPath: z.string().trim().transform(removeTrailingSlash),
environment: z.string().trim(),
interval: z.number().min(1),
provider: z.string().trim(),