mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
feat(secret-sync): validate secret names using SecretNameSchema before processing
This commit is contained in:
@@ -63,6 +63,7 @@ import { TAppConnectionDALFactory } from "../app-connection/app-connection-dal";
|
||||
import { TFolderCommitServiceFactory } from "../folder-commit/folder-commit-service";
|
||||
import { TNotificationServiceFactory } from "../notification/notification-service";
|
||||
import { NotificationType } from "../notification/notification-types";
|
||||
import { SecretNameSchema } from "@app/server/lib/schemas";
|
||||
|
||||
export type TSecretSyncQueueFactory = ReturnType<typeof secretSyncQueueFactory>;
|
||||
|
||||
@@ -408,6 +409,14 @@ export const secretSyncQueueFactory = ({
|
||||
|
||||
if (!Object.keys(importedSecrets).length) return {};
|
||||
|
||||
for (const [key] of Object.entries(importedSecrets)) {
|
||||
const result = SecretNameSchema.safeParse(key);
|
||||
if (!result.success) {
|
||||
const errorMessage = result.error.issues[0]?.message || "Invalid secret name";
|
||||
throw new Error(`Invalid secret name "${key}": ${errorMessage}`);
|
||||
}
|
||||
}
|
||||
|
||||
const importedSecretMap: TSecretMap = {};
|
||||
|
||||
const secretMap = await $getInfisicalSecrets(secretSync, false);
|
||||
|
||||
Reference in New Issue
Block a user