Update Deno project configuration to use 127.0.0.1 instead of localhost for network permissions and server bindings. Adjust tests to reflect changes in server address handling.
This commit is contained in:
parent
baedc1f32a
commit
9d8c52eb02
4 changed files with 14 additions and 14 deletions
14
deno.json
14
deno.json
|
@ -14,13 +14,13 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"proxy:start": "deno run --allow-env --allow-read --allow-sys --allow-run=open --allow-write=\"$HOME/.mcp-auth/mcp-remote-deno-1.0.0\" --allow-net=0.0.0.0,localhost src/proxy.ts",
|
"proxy:start": "deno run --allow-env --allow-read --allow-sys=homedir --allow-run=open --allow-write=\"$HOME/.mcp-auth/mcp-remote-deno-1.0.0\" --allow-net=0.0.0.0,127.0.0.1,localhost src/proxy.ts",
|
||||||
"proxy:watch": "deno run --watch --allow-env --allow-read --allow-sys --allow-run=open --allow-write=\"$HOME/.mcp-auth/mcp-remote-deno-1.0.0\" --allow-net=0.0.0.0,localhost src/proxy.ts",
|
"proxy:watch": "deno run --watch --allow-env --allow-read --allow-sys=homedir --allow-run=open --allow-write=\"$HOME/.mcp-auth/mcp-remote-deno-1.0.0\" --allow-net=0.0.0.0,127.0.0.1,localhost src/proxy.ts",
|
||||||
"client:start": "deno run --allow-env --allow-read --allow-sys --allow-run=open --allow-write=\"$HOME/.mcp-auth/mcp-remote-deno-1.0.0\" --allow-net=0.0.0.0,localhost src/client.ts",
|
"client:start": "deno run --allow-env --allow-read --allow-sys=homedir --allow-run=open --allow-write=\"$HOME/.mcp-auth/mcp-remote-deno-1.0.0\" --allow-net=0.0.0.0,127.0.0.1,localhost src/client.ts",
|
||||||
"client:watch": "deno run --watch --allow-env --allow-read --allow-sys --allow-run=open --allow-write=\"$HOME/.mcp-auth/mcp-remote-deno-1.0.0\" --allow-net=0.0.0.0,localhost src/client.ts",
|
"client:watch": "deno run --watch --allow-env --allow-read --allow-sys=homedir --allow-run=open --allow-write=\"$HOME/.mcp-auth/mcp-remote-deno-1.0.0\" --allow-net=0.0.0.0,127.0.0.1,localhost src/client.ts",
|
||||||
"test": "deno test --allow-net --allow-env --allow-read tests/",
|
"test": "deno test --allow-net=0.0.0.0,127.0.0.1,localhost --allow-env --allow-read --allow-sys=homedir tests/",
|
||||||
"test:watch": "deno test --watch --allow-net --allow-env --allow-read tests/",
|
"test:watch": "deno test --watch --allow-net=0.0.0.0,127.0.0.1,localhost --allow-env --allow-read --allow-sys=homedir tests/",
|
||||||
"test:coverage": "deno test --coverage=coverage --allow-net --allow-env --allow-read tests/ && deno coverage coverage"
|
"test:coverage": "deno test --coverage=coverage --allow-net=0.0.0.0,127.0.0.1,localhost --allow-env --allow-read --allow-sys=homedir tests/ && deno coverage coverage"
|
||||||
},
|
},
|
||||||
"imports": {
|
"imports": {
|
||||||
"std/": "https://deno.land/std@0.224.0/",
|
"std/": "https://deno.land/std@0.224.0/",
|
||||||
|
|
|
@ -159,7 +159,7 @@ export async function coordinateAuth(
|
||||||
log("Authentication completed by another instance");
|
log("Authentication completed by another instance");
|
||||||
|
|
||||||
// Setup a dummy server - the client will use tokens directly from disk
|
// Setup a dummy server - the client will use tokens directly from disk
|
||||||
const dummyServer = express().listen(0, "localhost"); // Listen on any available port on localhost only
|
const dummyServer = express().listen(0, "127.0.0.1"); // Listen on any available port on localhost only
|
||||||
|
|
||||||
// This shouldn't actually be called in normal operation, but provide it for API compatibility
|
// This shouldn't actually be called in normal operation, but provide it for API compatibility
|
||||||
const dummyWaitForAuthCode = () => {
|
const dummyWaitForAuthCode = () => {
|
||||||
|
|
|
@ -247,7 +247,7 @@ export function setupOAuthCallbackServerWithLongPoll(
|
||||||
options.events.emit("auth-code-received", code);
|
options.events.emit("auth-code-received", code);
|
||||||
});
|
});
|
||||||
|
|
||||||
const server = app.listen(options.port, "localhost", () => {
|
const server = app.listen(options.port, "127.0.0.1", () => {
|
||||||
log(`OAuth callback server running at http://127.0.0.1:${options.port}`);
|
log(`OAuth callback server running at http://127.0.0.1:${options.port}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ export function findAvailablePort(
|
||||||
server.on("error", (err: NodeJS.ErrnoException) => {
|
server.on("error", (err: NodeJS.ErrnoException) => {
|
||||||
if (err.code === "EADDRINUSE") {
|
if (err.code === "EADDRINUSE") {
|
||||||
// If preferred port is in use, get a random port
|
// If preferred port is in use, get a random port
|
||||||
server.listen({ port: 0, hostname: "localhost" });
|
server.listen({ port: 0, hostname: "127.0.0.1" });
|
||||||
} else {
|
} else {
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ export function findAvailablePort(
|
||||||
});
|
});
|
||||||
|
|
||||||
// Try preferred port first, or get a random port
|
// Try preferred port first, or get a random port
|
||||||
server.listen({ port: preferredPort || 0, hostname: "localhost" });
|
server.listen({ port: preferredPort || 0, hostname: "127.0.0.1" });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,9 +76,9 @@ describe("DenoHttpServer", () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
serverInstance = server.listen(localTestPort, "localhost");
|
serverInstance = server.listen(localTestPort, "localhost");
|
||||||
// Use the port property directly - we know our implementation returns an object with port
|
// Our implementation returns an object with address() that returns {port}
|
||||||
const port = (serverInstance as unknown as { port: number }).port;
|
const addr = serverInstance.address() as { port: number };
|
||||||
assertEquals(port, localTestPort);
|
assertEquals(localTestPort, addr.port);
|
||||||
} finally {
|
} finally {
|
||||||
if (serverInstance) {
|
if (serverInstance) {
|
||||||
server.close();
|
server.close();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue