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.

737 B
Raw Blame
/** Peer data may echo credentials in values, object keys, or JSON-RPC errors. */
export function a2aResponseRedactor(auth: Record<string, string>) {
  const secrets = [...new Set(Object.values(auth).flatMap((value) => [value, value.replace(/^Bearer\s+/i, "")]).filter(Boolean))].sort((a, b) => b.length - a.length);
  const redact = (value: unknown): unknown => {
    if (typeof value === "string") return secrets.reduce((text, secret) => text.split(secret).join("[redacted]"), value);
    if (Array.isArray(value)) return value.map(redact);
    if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([key, item]) => [String(redact(key)), redact(item)]));
    return value;
  };
  return redact;
}