Skip to content

Commit 2fbb0d5

Browse files
committed
Do not allow decofile/release endpoints
Signed-off-by: Marcos Candeia <[email protected]>
1 parent 97a0130 commit 2fbb0d5

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

deno.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@deco/mcp",
3-
"version": "0.3.2",
3+
"version": "0.3.3",
44
"exports": "./mod.ts",
55
"tasks": {
66
"check": "deno fmt && deno lint && deno check mod.ts"

mcp/server.ts

+4
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ function registerTools<TManifest extends AppManifest>(
282282
});
283283
}
284284

285+
const UNAUTHORIZED_PATHS = ["/live/release", "/.decofile"];
285286
const MESSAGES_ENDPOINT = "/mcp/messages";
286287
export function mcpServer<TManifest extends AppManifest>(
287288
deco: Deco<TManifest>,
@@ -346,6 +347,9 @@ export function mcpServer<TManifest extends AppManifest>(
346347
transport.close(); // Close the transport after handling the message
347348
return response;
348349
}
350+
if (UNAUTHORIZED_PATHS.some((p) => path.startsWith(p))) {
351+
return c.json({ error: "Unauthorized" }, 401);
352+
}
349353
await next();
350354
};
351355
}

mcp/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function dereferenceSchema(
2929
const referencedSchema = definitions[refId];
3030

3131
// Save the original schema metadata (excluding $ref)
32-
const { $ref, ...originalMetadata } = schema;
32+
const { $ref: _, ...originalMetadata } = schema;
3333

3434
// Merge the original metadata with the dereferenced schema
3535
return {

0 commit comments

Comments
 (0)