Skip to content

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

misc: addressed feedback

Sheen Capadngand67c83530eec
diff --git a/backend/src/ee/services/agent-vault-access-bundle/agent-vault-access-bundle-service.ts b/backend/src/ee/services/agent-vault-access-bundle/agent-vault-access-bundle-service.ts
index ef7a6efc58..48baf999f4 100644
--- a/backend/src/ee/services/agent-vault-access-bundle/agent-vault-access-bundle-service.ts
+++ b/backend/src/ee/services/agent-vault-access-bundle/agent-vault-access-bundle-service.ts
@@ -1864,6 +1864,22 @@ export const agentVaultAccessBundleServiceFactory = (deps: TAgentVaultAccessBund
return { name: header.name, prefix: header.prefix, text: openValue(match.encryptedValue) };
});
assertCustomHeadersDoNotShadowCredential({ type: credentialType, headerName: credentialHeader.name }, headerTexts);
+ // A rejection only blames the saved token when nothing else in the request differs from what is saved: a wrong
+ // typed header must not refresh the token, or mark the saved service as needing reauthorization.
+ const isSavedConnection =
+ service !== undefined &&
+ transport === (service.config as TAgentVaultServiceConfig | null)?.transport &&
+ (!customHeaders ||
+ (customHeaders.length === storedCustomHeaders.length &&
+ customHeaders.every((header, index) => {
+ const match = matchedHeaders[index];
+ return (
+ header.value === undefined &&
+ match !== undefined &&
+ header.name.toLowerCase() === match.name.toLowerCase() &&
+ (header.prefix ?? "") === match.prefix
+ );
+ })));
const texts = [
...(credentialHeader.isTyped ? [credentialHeader.value] : []),
@@ -1894,7 +1910,8 @@ export const agentVaultAccessBundleServiceFactory = (deps: TAgentVaultAccessBund
} catch (err) {
// A saved token can be refused before it expires (revoked, or no expiry from the provider), so it is refreshed
// once, as the proxy does, before the admin is asked to reauthorize.
- if (!(err instanceof McpListError && err.isCredentialRejected) || !refreshSavedToken) throw err;
+ if (!(err instanceof McpListError && err.isCredentialRejected) || !refreshSavedToken || !isSavedConnection)
+ throw err;
const refreshedToken = await refreshSavedToken(hashAccessToken(credentialValue));
if (refreshedToken === credentialValue) throw err;
return { tools: await listWith(refreshedToken) };
diff --git a/frontend/src/components/agent-vault/service-sheet/McpToolsFields.tsx b/frontend/src/components/agent-vault/service-sheet/McpToolsFields.tsx
index 290b339062..ee1385f165 100644
--- a/frontend/src/components/agent-vault/service-sheet/McpToolsFields.tsx
+++ b/frontend/src/components/agent-vault/service-sheet/McpToolsFields.tsx
@@ -199,6 +199,7 @@ export const McpToolsFields = ({
}
creation={{
isDisabled: isAtLimit,
+ emptyLabel: "Type a tool's exact name to add it",
isValid: (inputValue) => !toolNameError(inputValue),
// The proxy matches names exactly, so a name differing only in case from a listed tool
// is almost certainly a typo for it.
diff --git a/frontend/src/components/agent-vault/service-sheet/ServiceSheet.tsx b/frontend/src/components/agent-vault/service-sheet/ServiceSheet.tsx
index 3e0323df39..f44502b886 100644
--- a/frontend/src/components/agent-vault/service-sheet/ServiceSheet.tsx
+++ b/frontend/src/components/agent-vault/service-sheet/ServiceSheet.tsx
@@ -761,8 +761,12 @@ export const ServiceSheet = ({
service
);
const isAwaitingAuthorization = current.step === ServiceStep.Credential && isAuthorizationMissing;
- // Set once a sign-in expired or was refused; only authorizing again on the Credential step clears it.
- const isAuthorizationRejected = isAuthorizationMissing && Boolean(oauthAuthorizationRejection);
+ // Set once a sign-in expired or was refused, even when a saved login could stand in for it; only authorizing
+ // again or keeping the current login on the Credential step clears it.
+ const isAuthorizationRejected =
+ isMcp &&
+ credentialType === AgentVaultCredentialType.OAuth &&
+ Boolean(oauthAuthorizationRejection);
const isTemplateStep = current.step === ServiceStep.Template;
const saveLabel = isUpdate ? "Save" : "Add Service";