mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-15 16:35:17 +00:00
feat: enhance vault provider access control and environment variable handling
- Updated the environment autocomplete component to include projectId and environmentId in vault secret fetching logic. - Added authorization checks in the vault provider router to ensure users have access to the specified project and environment. - Modified the vault provider schema to include projectId and optional environmentId for better validation. - Improved error handling for unauthorized access and invalid vault provider assignments.
This commit is contained in:
@@ -85,9 +85,13 @@ export const useEnvCompletionSource = ({
|
||||
const vaultSecret = /^vault\.([a-zA-Z0-9_-]+)\.([^}\n]*)$/.exec(inner);
|
||||
if (vaultSecret) {
|
||||
const provider = providers?.find((p) => p.name === vaultSecret[1]);
|
||||
if (!provider) return null;
|
||||
if (!provider || !projectId) return null;
|
||||
const names = await utils.vaultProvider.listSecretNames
|
||||
.fetch({ vaultProviderId: provider.vaultProviderId })
|
||||
.fetch({
|
||||
vaultProviderId: provider.vaultProviderId,
|
||||
projectId,
|
||||
environmentId,
|
||||
})
|
||||
.catch(() => [] as string[]);
|
||||
return {
|
||||
from: innerFrom + `vault.${vaultSecret[1]}.`.length,
|
||||
@@ -176,6 +180,14 @@ export const useEnvCompletionSource = ({
|
||||
|
||||
return null;
|
||||
},
|
||||
[providers, projectEnv, environmentEnv, includeShared, utils],
|
||||
[
|
||||
providers,
|
||||
projectEnv,
|
||||
environmentEnv,
|
||||
includeShared,
|
||||
projectId,
|
||||
environmentId,
|
||||
utils,
|
||||
],
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user