Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
fix: reject login redirects normalized into external destinations
Rahmanc2eb8e3e46ba
diff --git a/lib/auth/return-path.test.ts b/lib/auth/return-path.test.tsindex 05d72ea4..9100913c 100644--- a/lib/auth/return-path.test.ts+++ b/lib/auth/return-path.test.ts@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";import { safeReturnPath } from "./return-path";describe("login return path", () => {- it.each(["https://evil.test", "//evil.test", "/\\\\evil.test", "/\n/evil.test", "/login?returnTo=/login", null])("rejects unsafe destination %j", value => {+ it.each(["https://evil.test", "//evil.test", "/x/..//evil.test", "/x/%2e%2e//evil.test", "/\\\\evil.test", "/\n/evil.test", "/login?returnTo=/login", null])("rejects unsafe destination %j", value => {expect(safeReturnPath(value)).toBe("/");});it("preserves a local destination and query", () => {diff --git a/lib/auth/return-path.ts b/lib/auth/return-path.tsindex 7607ba25..8bd0165c 100644--- a/lib/auth/return-path.ts+++ b/lib/auth/return-path.ts@@ -3,6 +3,6 @@ export function safeReturnPath(value: unknown): string {if (typeof value !== "string" || !value.startsWith("/") || value.startsWith("//")) return "/";if (/[\\\\\x00-\x20\x7f]/.test(value) || value.length > 2048) return "/";const url = new URL(value, "https://mso.example.invalid");- if (url.origin !== "https://mso.example.invalid" || url.pathname === "/login") return "/";+ if (url.origin !== "https://mso.example.invalid" || url.pathname.startsWith("//") || url.pathname === "/login") return "/";return url.pathname + url.search + url.hash;}