validate secret provider config before save

This commit is contained in:
jarek committed 2026-08-14 14:01:36 +02:00
1 parent 344ad4aadc
commit 5fef45e003
8 files changed
+106 -31

No files matched your search

+5 -8
View File
@@ -6,7 +6,7 @@
*/
import type { SecretProviderConfig, SecretProviderType } from './secretproviders/shared';
import { SECRET_CONFIG_KEYS } from './secretproviders/shared';
import { mergeProviderConfigForWrite } from './secretproviders/shared';
import {
db,
isPostgres,
@@ -386,13 +386,10 @@ export async function updateSecretProvider(
if (typeUnchanged) {
const existing = await getSecretProviderById(id);
if (existing) {
for (const key of SECRET_CONFIG_KEYS) {
const incoming = (data.config as Record<string, unknown>)[key];
if (incoming === undefined || incoming === '') {
const stored = (existing.config as Record<string, unknown>)[key];
if (stored !== undefined) merged[key] = stored;
}
}
merged = mergeProviderConfigForWrite(
data.config as Record<string, unknown>,
existing.config as Record<string, unknown>
);
}
}
const encrypted = encrypt(JSON.stringify(merged));