inital commit

This commit is contained in:
KingKDot
2026-03-05 00:04:26 -06:00
commit f8515a2883
269 changed files with 47081 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
import { logger } from "../logger";
export function isAuthorizedAgentRequest(
req: Request,
url: URL,
agentToken?: string,
): boolean {
const disableAuth =
String(process.env.OVERLORD_DISABLE_AGENT_AUTH || "").toLowerCase() ===
"true";
if (disableAuth) {
logger.info("[auth] Agent auth explicitly disabled by OVERLORD_DISABLE_AGENT_AUTH=true");
return true;
}
const token = agentToken?.trim();
if (!token) {
logger.info("[auth] Agent auth disabled");
return true;
}
const headerToken = req.headers.get("x-agent-token");
const queryToken = url.searchParams.get("token");
const isAuthed = headerToken === token || queryToken === token;
if (!isAuthed) {
logger.info("[auth] Agent auth failed");
} else {
logger.info("[auth] Agent authenticated successfully");
}
return isAuthed;
}