Skip to content

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

use organizations in the oidc issuer path and add standard discovery fields

DimitrisStaratzis44d05565b670
diff --git a/backend/AGENTS.md b/backend/AGENTS.md
index 3bf6c11277..f1a6e4e355 100644
--- a/backend/AGENTS.md
+++ b/backend/AGENTS.md
@@ -1150,7 +1150,7 @@ failure is logged, never thrown, so the original outcome stands.
`services/oidc-issuer` signs short-lived JWTs that cloud providers exchange for access tokens, so a
connection needs no stored client secret. Each org is its own issuer at
-`/api/v1/oidc-issuer/orgs/<orgId>`, with public discovery and JWKS routes under `.well-known`. The issuer
+`/api/v1/oidc-issuer/organizations/<orgId>`, with public discovery and JWKS routes under `.well-known`. The issuer
URL and the `sub` shape are one-way doors: customers copy both into their provider.
- **Keys are reserved `sign-verify` `kms_keys` rows named `oidc-issuer-*`, not a new `keyUsage`.** The
diff --git a/backend/src/keystore/keystore.ts b/backend/src/keystore/keystore.ts
index f4b44a57b7..af90256f60 100644
--- a/backend/src/keystore/keystore.ts
+++ b/backend/src/keystore/keystore.ts
@@ -253,7 +253,6 @@ export const KeyStorePrefixes = {
};
export const KeyStoreTtls = {
- OidcIssuerJwksInSeconds: 10 * 60,
LdapDirectoryMachinesInSeconds: 60,
LdapHostLoginInSeconds: 3600,
LdapGuessedHostLoginInSeconds: 30,
@@ -323,7 +322,8 @@ export const KeyStoreTtls = {
SecretReplicationSuccessInSeconds: 10,
NativeIntegrationDeprecationNoticeInSeconds: 3888000, // 45 days - outlives one monthly cycle
LegacyPkiDeprecationNoticeInSeconds: 3888000, // 45 days - outlives one monthly cycle
- WorkerHeartbeatInSeconds: 300 // 5 minutes - tolerates several missed 60s beats
+ WorkerHeartbeatInSeconds: 300, // 5 minutes - tolerates several missed 60s beats
+ OidcIssuerJwksInSeconds: 600 // 10 minutes
};
type TDeleteItems = {
diff --git a/backend/src/server/routes/v1/oidc-issuer-router.ts b/backend/src/server/routes/v1/oidc-issuer-router.ts
index 66c6089cb7..ea02c024a9 100644
--- a/backend/src/server/routes/v1/oidc-issuer-router.ts
+++ b/backend/src/server/routes/v1/oidc-issuer-router.ts
@@ -4,18 +4,19 @@ import { oidcIssuerLimit } from "@app/server/config/rateLimiter";
// The next key is published a full signing period (24h) before it signs, so a cached JWKS younger than that
// always holds the signing key
-const CACHE_MAX_AGE_SECONDS = 60 * 60;
+const CACHE_CONTROL = `public, max-age=${60 * 60}, must-revalidate`;
const OrgParamsSchema = z.object({
- orgId: z.string().uuid()
+ organizationId: z.string().uuid()
});
// Unauthenticated, and shaped by OpenID Connect Discovery 1.0 and RFC 7517 rather than the house envelope,
-// because cloud providers fetch them to verify tokens Infisical signs
+// because cloud providers fetch them to verify tokens Infisical signs. These paths are part of each org's issuer
+// URL, which customers paste into their providers, so they can never move or be renamed.
export const registerOidcIssuerRouter = async (server: FastifyZodProvider) => {
server.route({
method: "GET",
- url: "/orgs/:orgId/.well-known/openid-configuration",
+ url: "/organizations/:organizationId/.well-known/openid-configuration",
config: {
rateLimit: oidcIssuerLimit
},
@@ -28,19 +29,21 @@ export const registerOidcIssuerRouter = async (server: FastifyZodProvider) => {
jwks_uri: z.string(),
response_types_supported: z.string().array(),
subject_types_supported: z.string().array(),
- id_token_signing_alg_values_supported: z.string().array()
+ id_token_signing_alg_values_supported: z.string().array(),
+ scopes_supported: z.string().array(),
+ claims_supported: z.string().array()
})
}
},
handler: async (req, res) => {
- void res.header("Cache-Control", `public, max-age=${CACHE_MAX_AGE_SECONDS}`);
- return server.services.oidcIssuer.getDiscoveryDocument(req.params.orgId);
+ void res.header("Cache-Control", CACHE_CONTROL);
+ return server.services.oidcIssuer.getDiscoveryDocument(req.params.organizationId);
}
});
server.route({
method: "GET",
- url: "/orgs/:orgId/.well-known/jwks.json",
+ url: "/organizations/:organizationId/.well-known/jwks.json",
config: {
rateLimit: oidcIssuerLimit
},
@@ -63,10 +66,10 @@ export const registerOidcIssuerRouter = async (server: FastifyZodProvider) => {
}
},
handler: async (req, res) => {
- const jwks = await server.services.oidcIssuer.getJwks(req.params.orgId);
+ const jwks = await server.services.oidcIssuer.getJwks(req.params.organizationId);
// An org gets keys on its first sign, so an empty set must not be cached or that first token fails to verify
- void res.header("Cache-Control", jwks.keys.length ? `public, max-age=${CACHE_MAX_AGE_SECONDS}` : "no-store");
+ void res.header("Cache-Control", jwks.keys.length ? CACHE_CONTROL : "no-store");
return jwks;
}
});
diff --git a/backend/src/services/oidc-issuer/oidc-issuer-service.ts b/backend/src/services/oidc-issuer/oidc-issuer-service.ts
index b7661d1a4d..52076c9b5e 100644
--- a/backend/src/services/oidc-issuer/oidc-issuer-service.ts
+++ b/backend/src/services/oidc-issuer/oidc-issuer-service.ts
@@ -43,7 +43,7 @@ export const oidcIssuerServiceFactory = ({ kmsDAL, kmsService, keyStore }: TOidc
});
}
- return `${SITE_URL}/api/v1/oidc-issuer/orgs/${orgId}`;
+ return `${SITE_URL}/api/v1/oidc-issuer/organizations/${orgId}`;
};
// Issuer keys are reserved, so no customer can create one; the prefix only tells them apart from the
@@ -164,7 +164,10 @@ export const oidcIssuerServiceFactory = ({ kmsDAL, kmsService, keyStore }: TOidc
jwks_uri: `${issuer}/.well-known/jwks.json`,
response_types_supported: ["id_token"],
subject_types_supported: ["public"],
- id_token_signing_alg_values_supported: [OIDC_ISSUER_SIGNING_ALG]
+ id_token_signing_alg_values_supported: [OIDC_ISSUER_SIGNING_ALG],
+ scopes_supported: ["openid"],
+ // Must list every claim signToken sets
+ claims_supported: ["iss", "sub", "aud", "exp", "iat", "nbf", "jti"]
};
};