Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(control-api): leave the unused revocation endpoint out of the same-site rule

Jose Gabriel Ramirez Encinas3e21083a8d46
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index 1b0663181..c46e2a6f0 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.704",
+ "version": "0.1.705",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.704",
+ "version": "0.1.705",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/grok-provider-attempt-contract": "file:../packages/grok-provider-attempt-contract",
diff --git a/control-api/package.json b/control-api/package.json
index 6f1d09e83..36f28b767 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.704",
+ "version": "0.1.705",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/src/oauth/discovery.ts b/control-api/src/oauth/discovery.ts
index 31e7c1ba4..f94667d51 100644
--- a/control-api/src/oauth/discovery.ts
+++ b/control-api/src/oauth/discovery.ts
@@ -170,7 +170,6 @@ export interface AsEndpointSites {
authorization: string
token: string
registration?: string
- revocation?: string
}
export type AsEndpointSiteCheck =
@@ -185,10 +184,12 @@ export type AsEndpointSiteCheck =
* client at the honest AS and redeem its codes at the attacker. With `iss` the response
* is bound to the issuer and this rule is not needed.
*
- * `revocation` is checked although nothing sends to it yet, so the day it is used it
- * cannot receive refresh tokens on an unvalidated host. A `null` site is never equal to
- * anything, including another `null`. Pure: callers pass the endpoints they are about
- * to trust (discovery output, or the values pinned on a CR).
+ * Only the endpoints we send to are checked. `revocation_endpoint` is neither used nor
+ * pinned on the CR, so an off-site or malformed one must not block an install; whatever
+ * starts sending refresh tokens to it must first pin it on the CR and add it here (and
+ * to the runtime coherence rule). A `null` site is never equal to anything, including
+ * another `null`. Pure: callers pass the endpoints they are about to trust (discovery
+ * output, or the values pinned on a CR).
*/
export function checkAsEndpointsSameSite(endpoints: AsEndpointSites): AsEndpointSiteCheck {
const issuerSite = registrableSite(endpoints.issuer)
@@ -204,7 +205,6 @@ export function checkAsEndpointsSameSite(endpoints: AsEndpointSites): AsEndpoint
'authorization',
'token',
'registration',
- 'revocation',
]
for (const field of fields) {
const url = endpoints[field]
@@ -762,7 +762,6 @@ export async function discoverRemoteOAuth(
...(typeof as.registration_endpoint === 'string'
? { registration: as.registration_endpoint }
: {}),
- ...(typeof as.revocation_endpoint === 'string' ? { revocation: as.revocation_endpoint } : {}),
})
if (!sameSite.ok) {
log.warn(
diff --git a/control-api/test/oauth.discovery.sameSite.test.ts b/control-api/test/oauth.discovery.sameSite.test.ts
index 5c1af8901..d81fab4f0 100644
--- a/control-api/test/oauth.discovery.sameSite.test.ts
+++ b/control-api/test/oauth.discovery.sameSite.test.ts
@@ -131,17 +131,18 @@ describe('discovery same-site rule — mixed metadata (mix-up via a borrowed AS)
})
})
- it('revocation endpoint on another site → rejected', async () => {
- const { outcome } = await discover(
- atlassianWith(as => {
- as.revocation_endpoint = 'https://attacker.example/revoke'
- })
- )
- expect(!outcome.ok && outcome.error).toMatchObject({
- kind: 'as_endpoints_cross_site',
- field: 'revocation',
+ // Nothing sends to the revocation endpoint and it is not pinned on the CR, so it is
+ // not trusted with anything; an off-site or relative one must not block the install.
+ for (const revocation of ['https://attacker.example/revoke', '/oauth/revoke']) {
+ it(`revocation endpoint ${JSON.stringify(revocation)} → ignored, discovery succeeds`, async () => {
+ const { outcome } = await discover(
+ atlassianWith(as => {
+ as.revocation_endpoint = revocation
+ })
+ )
+ expect(outcome.ok).toBe(true)
})
- })
+ }
it('authorization endpoint on another site → rejected', async () => {
const { outcome } = await discover(
@@ -199,7 +200,6 @@ describe('registrableSite / checkAsEndpointsSameSite (PSL semantics)', () => {
authorization: 'https://vercel.com/oauth/authorize',
token: 'https://api.vercel.com/login/oauth/token',
registration: 'https://api.vercel.com/login/oauth/register',
- revocation: 'https://api.vercel.com/login/oauth/token/revoke',
})
).toEqual({ ok: true })
})