Skip to content

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

TypeScript

test(mcp-host): pin sentinel-lookalike userIds against SHARED collision (R4-L4)

Diego Zacarias336813818202
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index 9d35f6cba..8851e9e6b 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.290",
+ "version": "0.1.291",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.290",
+ "version": "0.1.291",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@anthropic-ai/sdk": "^0.32.0",
diff --git a/mcp-host/package.json b/mcp-host/package.json
index db8625311..63fe91810 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.290",
+ "version": "0.1.291",
"description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude",
"main": "dist/main.js",
"engines": {
diff --git a/mcp-host/src/mcp/__tests__/managerPartition.test.ts b/mcp-host/src/mcp/__tests__/managerPartition.test.ts
index 35bda0223..2cb2ae661 100644
--- a/mcp-host/src/mcp/__tests__/managerPartition.test.ts
+++ b/mcp-host/src/mcp/__tests__/managerPartition.test.ts
@@ -155,6 +155,19 @@ describe('ClientKey — SHARED sentinel never collides with a real userId', () =
)
})
+ it('sentinel-lookalike userIds never collide with the SHARED key', () => {
+ // fc.string() effectively never emits the values that could plausibly
+ // collide (the 's' discriminator, the 'shared' word, the serverName, or the
+ // serialized shared key itself), so pin them explicitly: the ['u',…] vs
+ // ['s',…] tuple discriminator must keep every real user distinct from SHARED.
+ const serverName = 'srv'
+ const sharedKey = serializeClientKey(serverName, SHARED_PRINCIPAL)
+ const adversarial = ['s', 'shared', 'SHARED', '', ' ', serverName, 'u', sharedKey]
+ for (const userId of adversarial) {
+ expect(serializeClientKey(serverName, userPrincipal(userId))).not.toBe(sharedKey)
+ }
+ })
+
it('serialization is injective over (serverName, principal) and round-trips serverName', () => {
fc.assert(
fc.property(fc.string(), fc.string(), fc.string(), (serverName, a, b) => {