Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
fix(auth): require explicit INITIAL_PASSWORD match on first password change
jacke62be7e6b3ca
diff --git a/src/app/api/settings/route.ts b/src/app/api/settings/route.tsindex bcfa59445d..23eb0355d9 100644--- a/src/app/api/settings/route.ts+++ b/src/app/api/settings/route.ts@@ -61,13 +61,24 @@ export async function PATCH(request) {}} else {// First-time password set (no DB hash yet).- // Accept empty current password, legacy default, or INITIAL_PASSWORD when configured.+ const LEGACY_DEFAULT_PASSWORD = "123456";const initialPassword = process.env.INITIAL_PASSWORD;const currentPassword = body.currentPassword || "";- const allowedWithoutHash = ["", "123456", ...(initialPassword ? [initialPassword] : [])];- if (!allowedWithoutHash.includes(currentPassword)) {- return NextResponse.json({ error: "Invalid current password" }, { status: 401 });+ if (initialPassword) {+ // If deploy is configured with INITIAL_PASSWORD, require explicit match.+ if (!currentPassword) {+ return NextResponse.json({ error: "Current password required" }, { status: 400 });+ }+ if (currentPassword !== initialPassword) {+ return NextResponse.json({ error: "Invalid current password" }, { status: 401 });+ }+ } else {+ // Legacy compatibility: instances without INITIAL_PASSWORD may still use old default.+ const allowedWithoutHash = ["", LEGACY_DEFAULT_PASSWORD];+ if (!allowedWithoutHash.includes(currentPassword)) {+ return NextResponse.json({ error: "Invalid current password" }, { status: 401 });+ }}}