Skip to content

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

TypeScript

test(control-api): cover per-server coherence without issuer or off-site registration

Jose Gabriel Ramirez Encinasc1313c1166a6
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index 3ad7459c2..5174523c5 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.702",
+ "version": "0.1.703",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.702",
+ "version": "0.1.703",
"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 4091ae6ff..7a971fdfa 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.702",
+ "version": "0.1.703",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/test/oauth.remoteSpecCoherence.test.ts b/control-api/test/oauth.remoteSpecCoherence.test.ts
index 1a8679350..4db160512 100644
--- a/control-api/test/oauth.remoteSpecCoherence.test.ts
+++ b/control-api/test/oauth.remoteSpecCoherence.test.ts
@@ -146,6 +146,30 @@ function crossSitePerServerOAuth(): Record<string, unknown> {
return oauth
}
+/** The Atlassian per-server DCR shape, coherent until a test edits it. */
+function perServerDcrOAuth(): Record<string, unknown> {
+ return buildRemoteOAuthSpec(perServerDiscovery, {
+ clientMode: 'public',
+ grantScope: 'user',
+ dynamicClientId: 'dyn-atlassian-public',
+ }) as unknown as Record<string, unknown>
+}
+
+/** A per-server CR written without `issuer`: no site to anchor the endpoints to. */
+function perServerWithoutIssuerOAuth(): Record<string, unknown> {
+ const oauth = perServerDcrOAuth()
+ delete oauth.issuer
+ return oauth
+}
+
+/** A per-server CR whose registration endpoint was moved off the issuer's site. */
+function crossSiteRegistrationOAuth(): Record<string, unknown> {
+ return {
+ ...perServerDcrOAuth(),
+ registrationEndpoint: 'https://register.example.net/oauth/register',
+ }
+}
+
const INCOHERENT = [
// CRD mirrors: refused in consent and token issuance alike.
{
@@ -174,6 +198,18 @@ const INCOHERENT = [
reason: 'as_endpoints_cross_site',
consentOnly: true,
},
+ {
+ label: 'per-server CR without an issuer',
+ oauth: perServerWithoutIssuerOAuth,
+ reason: 'as_endpoints_cross_site',
+ consentOnly: true,
+ },
+ {
+ label: 'per-server registration endpoint off the issuer site',
+ oauth: crossSiteRegistrationOAuth,
+ reason: 'as_endpoints_cross_site',
+ consentOnly: true,
+ },
] as const
function crFrom(
@@ -206,6 +242,11 @@ describe('resolver mirror of the remote CRD coherence rules', () => {
expect(crossSite.issForCallback).toBeUndefined()
expect(new URL(crossSite.tokenEndpoint as string).hostname).toBe('api.dropboxapi.com')
expect(new URL(crossSite.issuer as string).hostname).toMatch(/dropbox\.com$/)
+ // The edits below are the only incoherence in their shapes: the base is coherent.
+ const base = perServerDcrOAuth()
+ expect(base.issForCallback).toBeUndefined()
+ expect(resolveServerOAuthSubject(crFrom('srv', base), 'consent')?.decl.id).toBe(base.id)
+ expect(typeof base.registrationEndpoint).toBe('string')
})
for (const c of INCOHERENT) {