Skip to content

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

TypeScript

test(control-api): scope the connectors gateway method assertion (R1-H4)

Diego Zacarias41852fe13fc9
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index 962120e38..53fde9aec 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.505",
+ "version": "0.1.506",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.505",
+ "version": "0.1.506",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/image-policy": "file:../packages/image-policy",
diff --git a/control-api/package.json b/control-api/package.json
index d8374c01c..190e8d55c 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.505",
+ "version": "0.1.506",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/test/network.gateway.intent.test.ts b/control-api/test/network.gateway.intent.test.ts
index a7e7abdb8..c420a6c13 100644
--- a/control-api/test/network.gateway.intent.test.ts
+++ b/control-api/test/network.gateway.intent.test.ts
@@ -340,9 +340,20 @@ describe('network/gateway intent (manifest-level)', () => {
// so the derived guard below does not cover it — assert its location here or
// rpc-proxy's GET /rpc/connectors 403s at the edge (the shipped regression).
expect(gatewayConf).toContain('location ~ ^/api/v1/rpc/access/users/[^/]+/mcp-connectors$')
+ // Scope the method assertion to THIS block: `[^}]*?` cannot cross the block's
+ // closing brace, so deleting the connectors' own `limit_except GET {` makes
+ // this fail instead of silently matching a later location's limit_except
+ // (the vacuous-match defect the old `[\s\S]*?` had).
expect(gatewayConf).toMatch(
- /location ~ \^\/api\/v1\/rpc\/access\/users\/\[\^\/\]\+\/mcp-connectors\$ \{[\s\S]*?limit_except GET \{/
+ /location ~ \^\/api\/v1\/rpc\/access\/users\/\[\^\/\]\+\/mcp-connectors\$ \{[^}]*?limit_except GET \{/
)
+ // nginx resolves regex locations by first match in file order, so the
+ // default-deny `location /` MUST come after this allowlisted block.
+ const connectorsIdx = gatewayConf.indexOf('/mcp-connectors$ {')
+ const defaultDenyIdx = gatewayConf.indexOf('location / {')
+ expect(connectorsIdx).toBeGreaterThan(-1)
+ expect(defaultDenyIdx).toBeGreaterThan(-1)
+ expect(connectorsIdx).toBeLessThan(defaultDenyIdx)
expect(gatewayConf).toContain('location ~ ^/api/v1/rpc/access/users/[^/]+/mcp-hosts/[^/]+$')
expect(gatewayConf).toMatch(
/location ~ \^\/api\/v1\/rpc\/access\/users\/\[\^\/\]\+\/mcp-hosts\/\[\^\/\]\+\$ \{[\s\S]*?limit_except GET POST/