Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
improvement: address feedback
Scott Wilson36c60aeec726
diff --git a/backend-go/internal/services/auth/apiauth/authenticator.go b/backend-go/internal/services/auth/apiauth/authenticator.goindex 6d27764e48..4a6fed6880 100644--- a/backend-go/internal/services/auth/apiauth/authenticator.go+++ b/backend-go/internal/services/auth/apiauth/authenticator.go@@ -101,6 +101,13 @@ func (a *ApiAuthenticator) ValidateJWT(ctx context.Context, token string) (*auth// validateUserTokenClaims validates pre-parsed user JWT claims.func (a *ApiAuthenticator) validateUserTokenClaims(ctx context.Context, claims *UserJWTClaims) (*auth.Identity, error) {+ // Access tokens from the removed Agent Sentinel (MCP) product were signed as+ // ACCESS_TOKEN with an "mcp" claim and a live token session; without this guard+ // they would validate as full user sessions despite having been endpoint-scoped.+ if len(claims.MCP) > 0 {+ return nil, errutil.Unauthorized("This token was issued for the removed Agent Sentinel (MCP) product and is no longer accepted").WithErrf("validateUserTokenClaims: rejected mcp-scoped token")+ }+// 1. Find session by tokenVersionId + userId.session, err := a.findSessionByIDAndUserID(ctx, claims.TokenVersionID, claims.UserID)if err != nil {diff --git a/backend-go/internal/services/auth/apiauth/claims.go b/backend-go/internal/services/auth/apiauth/claims.goindex a4f4c31e6a..315febec89 100644--- a/backend-go/internal/services/auth/apiauth/claims.go+++ b/backend-go/internal/services/auth/apiauth/claims.go@@ -1,6 +1,7 @@package apiauthimport (+ "encoding/json""fmt""github.com/golang-jwt/jwt/v5"@@ -24,6 +25,11 @@ type UnifiedJWTClaims struct {SubOrganizationID uuid.UUID `json:"subOrganizationId,omitempty"`IsMfaVerified bool `json:"isMfaVerified,omitempty"`MfaMethod string `json:"mfaMethod,omitempty"`+ // MCP marks access tokens issued by the removed Agent Sentinel (MCP) product.+ // Kept only so those tokens can be explicitly rejected instead of validating+ // as full user sessions; json.RawMessage tolerates the historical bool and+ // object encodings of the claim.+ MCP json.RawMessage `json:"mcp,omitempty"`// Identity JWT fieldsIdentityID uuid.UUID `json:"identityId,omitempty"`@@ -54,6 +60,7 @@ func (c *UnifiedJWTClaims) ToUserClaims() *UserJWTClaims {SubOrganizationID: c.SubOrganizationID,IsMfaVerified: c.IsMfaVerified,MfaMethod: c.MfaMethod,+ MCP: c.MCP,}}@@ -108,6 +115,9 @@ type UserJWTClaims struct {SubOrganizationID uuid.UUID `json:"subOrganizationId,omitempty"`IsMfaVerified bool `json:"isMfaVerified,omitempty"`MfaMethod string `json:"mfaMethod,omitempty"`+ // See UnifiedJWTClaims.MCP: present only on tokens from the removed Agent+ // Sentinel (MCP) product, which must be rejected.+ MCP json.RawMessage `json:"mcp,omitempty"`}// IdentityJWTClaims represents the JWT payload for machine identity access tokens.diff --git a/backend/src/ee/routes/v1/removed-product-tombstone-router.ts b/backend/src/ee/routes/v1/removed-product-tombstone-router.tsindex 010972d353..9b9c737f33 100644--- a/backend/src/ee/routes/v1/removed-product-tombstone-router.ts+++ b/backend/src/ee/routes/v1/removed-product-tombstone-router.ts@@ -7,14 +7,17 @@ import { readLimit } from "@app/server/config/rateLimiter";// 410 Gone with an explanation instead.//// Deliberately unauthenticated: the response reveals nothing, performs no work, and-// must reach clients whose tokens are expired or invalid. Remove together with the-// deprecated permission subjects (see ProjectPermissionV2Schema) in a future-// breaking release.-export const registerRemovedProductTombstoneRouter =- (message: string) => async (server: FastifyZodProvider) => {+// must reach clients whose tokens are expired or invalid (inject-identity.ts skips+// auth injection for these prefixes to guarantee that). Remove together with that+// exemption and the deprecated permission subjects (see ProjectPermissionV2Schema)+// in a future breaking release.+export const registerRemovedProductTombstoneRouter = (message: string) => async (server: FastifyZodProvider) => {+ // "/" covers the bare prefix (ignoreTrailingSlash is on); "/*" covers every+ // sub-path the removed routers used to serve.+ ["/", "/*"].forEach((url) => {server.route({method: ["GET", "POST", "PUT", "PATCH", "DELETE"],- url: "/*",+ url,config: {rateLimit: readLimit},@@ -30,4 +33,5 @@ export const registerRemovedProductTombstoneRouter =});}});- };+ });+};diff --git a/backend/src/server/plugins/auth/inject-identity.ts b/backend/src/server/plugins/auth/inject-identity.tsindex ae4d8e6d28..cb075120a4 100644--- a/backend/src/server/plugins/auth/inject-identity.ts+++ b/backend/src/server/plugins/auth/inject-identity.ts@@ -134,6 +134,16 @@ export const extractAuth = async (req: FastifyRequest, jwtSecret: string) => {switch (decodedToken.authTokenType) {case AuthTokenType.ACCESS_TOKEN: {+ // Access tokens from the removed Agent Sentinel (MCP) product were signed as+ // ACCESS_TOKEN with an "mcp" claim and a live token session; without this+ // guard they would fall through and authenticate as a full user JWT session+ // despite having been endpoint-scoped.+ if ("mcp" in decodedToken) {+ throw new UnauthorizedError({+ message: "This token was issued for the removed Agent Sentinel (MCP) product and is no longer accepted"+ });+ }+if (decodedToken?.oauthClientId) {return {authMode: AuthMode.OAUTH,@@ -255,6 +265,14 @@ export const injectIdentity = fp(return;}+ // Tombstoned prefixes for the removed SSH / Agent Sentinel products answer+ // 410 without auth; skip injection so expired or invalid tokens from shipped+ // clients (the CLI always sends one) still receive the explanatory response+ // instead of a 401. Remove together with removed-product-tombstone-router.ts.+ if (pathname.startsWith("/api/v1/ssh/") || pathname.startsWith("/api/v1/ai/mcp/")) {+ return;+ }+const { authMode, token, actor } = await extractAuth(req, appCfg.AUTH_SECRET);if (!authMode) return;diff --git a/backend/src/services/project/project-dal.ts b/backend/src/services/project/project-dal.tsindex 44b7a0e247..7d7a04d709 100644--- a/backend/src/services/project/project-dal.ts+++ b/backend/src/services/project/project-dal.ts@@ -987,6 +987,9 @@ export const projectDALFactory = (db: TDbClient) => {.whereNotIn("type", [ProjectType.CertificateManager]).whereNull("deleteAfter").whereNotIn("type", [ProjectType.CertificateManager, ProjectType.PAM])+ // Project rows of the removed SSH / Agent Sentinel products are left in+ // place (see migration 20260729150000) but must not consume workspace quota.+ .whereNotIn("type", ["ssh", "ai"]).andWhere((bd) => {if (orgId) {void bd.where({ orgId }).orWhereIn("orgId", subOrgProjects);