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
@@ -2,6 +2,7 @@ import { z } from "zod";
import { ServiceTokensSchema } from "@app/db/schemas";
import { EventType } 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";
@@ -42,7 +43,7 @@ export const registerServiceTokenRouter = async (server: FastifyZodProvider) =>
scopes: z
.object({
environment: z.string().trim(),
secretPath: z.string().trim()
secretPath: z.string().trim().transform(removeTrailingSlash)
})
.array()
.min(1),