Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(rpc-proxy): cover host:session:write scope in the token allow-list
Diego Zacarias62232d687f80
diff --git a/external-rest-api/src/releaseManifest.ts b/external-rest-api/src/releaseManifest.tsindex 8aca438a2..35a4c430f 100644--- a/external-rest-api/src/releaseManifest.ts+++ b/external-rest-api/src/releaseManifest.ts@@ -9,7 +9,7 @@ export type ReleaseManifest = {export const releaseManifest: ReleaseManifest = {releaseId: 'v0.8.0',externalRestApiVersion: '0.1.81',- rpcProxyVersion: '0.1.76',+ rpcProxyVersion: '0.1.77',desktopVersion: '0.8.0',minimumDesktopVersion: '0.1.252',}diff --git a/rpc-proxy/package-lock.json b/rpc-proxy/package-lock.jsonindex 936ed964c..13318c48c 100644--- a/rpc-proxy/package-lock.json+++ b/rpc-proxy/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-rpc-proxy",- "version": "0.1.76",+ "version": "0.1.77","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-rpc-proxy",- "version": "0.1.76",+ "version": "0.1.77","dependencies": {"cors": "^2.8.5","express": "^4.21.2",diff --git a/rpc-proxy/package.json b/rpc-proxy/package.jsonindex 6aa1d131a..23471ba1e 100644--- a/rpc-proxy/package.json+++ b/rpc-proxy/package.json@@ -1,6 +1,6 @@{"name": "clerum-rpc-proxy",- "version": "0.1.76",+ "version": "0.1.77","description": "External-facing RPC proxy for tenant-scoped MCP access","main": "dist/main.js","engines": {diff --git a/rpc-proxy/src/authToken.test.ts b/rpc-proxy/src/authToken.test.tsindex 9dba47df0..938b65b27 100644--- a/rpc-proxy/src/authToken.test.ts+++ b/rpc-proxy/src/authToken.test.ts@@ -67,3 +67,35 @@ describe('verifyRpcToken access scope binding', () => {expect(verifyRpcToken('token')).toBeNull()})})++describe('verifyRpcToken scope allow-list', () => {+ beforeEach(() => jwtMock.verify.mockReset())++ it('preserves a write-only host:session:write token through the allow-list filter', () => {+ jwtMock.verify.mockReturnValue({+ ...BASE_PAYLOAD,+ scopes: ['host:session:write'],+ accessScope: 'user',+ teamId: null,+ })++ // Guards the ALLOWED_SCOPES membership of 'host:session:write': dropping it+ // there would filter a write-only token down to zero scopes -> null -> 401.+ expect(verifyRpcToken('token')).toMatchObject({+ scopes: ['host:session:write'],+ })+ })++ it('drops scopes outside the allow-list while keeping the recognized one', () => {+ jwtMock.verify.mockReturnValue({+ ...BASE_PAYLOAD,+ scopes: ['host:session:write', 'totally:unknown:scope'],+ accessScope: 'user',+ teamId: null,+ })++ expect(verifyRpcToken('token')).toMatchObject({+ scopes: ['host:session:write'],+ })+ })+})