Skip to content

armgit / mso

Public Imported from GitHub
0

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.

550 B
Raw Blame
// Same-origin paths only. Reject browser URL normalization tricks and login loops.
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.startsWith("//") || url.pathname === "/login") return "/";
  return url.pathname + url.search + url.hash;
}