Skip to content

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

loudly reject

Thiago Araujo da Silva46de5b726aac
diff --git a/backend/e2e-test/routes/v1/oauth-token-exchange.spec.ts b/backend/e2e-test/routes/v1/oauth-token-exchange.spec.ts
index c7e5908b74..374e8de7af 100644
--- a/backend/e2e-test/routes/v1/oauth-token-exchange.spec.ts
+++ b/backend/e2e-test/routes/v1/oauth-token-exchange.spec.ts
@@ -276,6 +276,22 @@ describe("POST /api/v1/oauth/token, token exchange grant", async () => {
expect(res.statusCode).toBe(400);
expect(res.payload).toContain("not supported");
});
+
+ // Ignoring these would answer a delegation request with an impersonation token, since the issued
+ // token records no acting party.
+ test("rejects an actor token rather than ignoring it", async () => {
+ const res = await postToken(exchangeBody({ actor_token: "some.actor.jwt" }));
+
+ expect(res.statusCode).toBe(400);
+ expect(res.payload).toContain("'actor_token'");
+ });
+
+ test("rejects an actor token type on its own", async () => {
+ const res = await postToken(exchangeBody({ actor_token_type: OauthTokenType.Jwt }));
+
+ expect(res.statusCode).toBe(400);
+ expect(res.payload).toContain("'actor_token'");
+ });
});
// Same session as the working jwtAuthToken, so it passes signature and session validation and differs
diff --git a/backend/src/server/routes/v1/oauth-router.ts b/backend/src/server/routes/v1/oauth-router.ts
index f9928c374f..9d97a31784 100644
--- a/backend/src/server/routes/v1/oauth-router.ts
+++ b/backend/src/server/routes/v1/oauth-router.ts
@@ -440,6 +440,8 @@ export const registerOAuthRouter = async (server: FastifyZodProvider) => {
subject_token: z.string().max(8192).optional(),
subject_token_type: z.nativeEnum(OauthTokenType).optional(),
requested_token_type: z.nativeEnum(OauthTokenType).optional(),
+ actor_token: z.string().max(8192).optional(),
+ actor_token_type: z.string().max(255).optional(),
audience: z.string().max(255).optional(),
resource: z.string().max(2048).optional(),
scope: z.string().max(2048).optional()
@@ -497,6 +499,13 @@ export const registerOAuthRouter = async (server: FastifyZodProvider) => {
});
}
+ if (req.body.actor_token || req.body.actor_token_type) {
+ throw new BadRequestError({
+ message:
+ "The 'actor_token' and 'actor_token_type' parameters are not supported. This grant issues a token that acts as the user in the subject token, and does not record the application as a separate acting party."
+ });
+ }
+
if (req.body.scope) {
throw new BadRequestError({
message:
diff --git a/docs/documentation/platform/oauth-applications/token-exchange.mdx b/docs/documentation/platform/oauth-applications/token-exchange.mdx
index 9fa2769404..963e3db66f 100644
--- a/docs/documentation/platform/oauth-applications/token-exchange.mdx
+++ b/docs/documentation/platform/oauth-applications/token-exchange.mdx
@@ -150,7 +150,9 @@ The response is an access token for the user the subject token identified:
Access token lifetime is the shortest of the application's **access token lifetime** (1 day by default), your organization's session length, and the instance default of 10 days. The application's own value is a ceiling rather than an override: it can shorten the lifetime but never extend it past what the organization allows. Because the middleware holds a credential that acts as the user, shorten it on the application rather than relying on the default.
<Note>
- `scope`, `audience`, and `resource` are rejected rather than ignored. This grant has no scope concept, and the expected audience is fixed on the application, so silently dropping those parameters would leave you believing a restriction was applied when it was not.
+ `scope`, `audience`, `resource`, and `actor_token` are rejected rather than ignored. This grant has no scope concept, and the expected audience is fixed on the application, so silently dropping those parameters would leave you believing a restriction was applied when it was not.
+
+ `actor_token` is refused for the same reason. RFC 8693 uses it to request **delegation**, where the issued token records that your middleware is acting for the user. Infisical issues an **impersonation** token, which is indistinguishable from the user's own and names no acting party, so accepting the parameter and dropping it would answer a delegation request with something weaker than you asked for. The requesting application is still recorded, in the audit event for the exchange and in every event the issued token produces.
</Note>
Use the access token as a standard Bearer token: