Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix validate scopes

adilson8ade767b0704
diff --git a/backend/src/ee/services/dynamic-secret/providers/models.ts b/backend/src/ee/services/dynamic-secret/providers/models.ts
index 74abd86abf..1e7e5d4cb9 100644
--- a/backend/src/ee/services/dynamic-secret/providers/models.ts
+++ b/backend/src/ee/services/dynamic-secret/providers/models.ts
@@ -901,14 +901,13 @@ export const DynamicSecretTailscaleSchema = z
// Tailscale requires ACL tags on tailnet-owned auth keys, which are the ones created via OAuth.
// Auth keys created with a user's API access token are user-owned and may omit tags.
if (
- data.authType === TailscaleKeyAuthType.AuthKeys &&
- data.auth.method === TailscaleAuthMethod.OAuth &&
+ (data.authType === TailscaleKeyAuthType.OAuthKeys || data.authType === TailscaleKeyAuthType.FederatedKeys) &&
data.tags.length === 0
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
path: ["tags"],
- message: "Tags are required when creating auth keys with OAuth authentication"
+ message: "Tags are required when the key type is OAuth or Federated Identity"
});
}
});
diff --git a/backend/src/ee/services/dynamic-secret/providers/tailscale.ts b/backend/src/ee/services/dynamic-secret/providers/tailscale.ts
index 13974f0f44..5fca9fd0eb 100644
--- a/backend/src/ee/services/dynamic-secret/providers/tailscale.ts
+++ b/backend/src/ee/services/dynamic-secret/providers/tailscale.ts
@@ -79,10 +79,11 @@ export const TailscaleProvider = (): TDynamicProviderFns => {
// oauth credentials issued can have the auth-keys or oauth scope, which allow them
// to modify other credentials. Let's block it so this is not possible
- const $validateScopes = async (scopes: string[]) => {
+ const $validateScopes = (scopes: string[]) => {
if (scopes.includes("auth-keys") || scopes.includes("oauth")) {
throw new BadRequestError({ message: "OAuth credentials cannot be used to create or modify other credentials" });
}
+ return scopes;
};
const validateConnection = async (inputs: unknown) => {