mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-26 22:11:20 -07:00
Change: just require auth for MCP
This commit is contained in:
@@ -617,19 +617,14 @@ describe("utils/mcp/homepage-mcp", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("checks MCP token and auth mode authorization", async () => {
|
||||
it("requires a matching MCP token for token authorization", async () => {
|
||||
const mod = await loadMcpWithConfigDir(mkdtempSync(path.join(tmpdir(), "homepage-mcp-test-")));
|
||||
|
||||
expect(mod.mcpTokenAuthorized({ headers: {} })).toBe(false);
|
||||
expect(mod.mcpAuthorized({ headers: {} })).toBe(true);
|
||||
|
||||
process.env.HOMEPAGE_AUTH_ENABLED = "true";
|
||||
expect(mod.mcpAuthorized({ headers: {} })).toBe(false);
|
||||
|
||||
process.env.HOMEPAGE_MCP_TOKEN = "secret";
|
||||
expect(mod.mcpTokenAuthorized({ headers: { authorization: "Bearer secret" } })).toBe(true);
|
||||
expect(mod.mcpTokenAuthorized({ headers: { "x-homepage-mcp-token": "secret" } })).toBe(true);
|
||||
expect(mod.mcpTokenAuthorized({ headers: { authorization: "Bearer wrong" } })).toBe(false);
|
||||
expect(mod.mcpAuthorized({ headers: { authorization: "Bearer secret" } })).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user