Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(logins): mask a held secret in its form-urlencoded spelling
Rudy Celekli19139f5c284f
diff --git a/server/login-store.test.ts b/server/login-store.test.tsindex b10325fc84..169d3c5813 100644--- a/server/login-store.test.ts+++ b/server/login-store.test.ts@@ -178,6 +178,13 @@ describe("the held-secret scrubber", () => {expect(held.scrub("alice signed in")).toBe("alice signed in");});+ it("masks a password a submitted form carried in a URL, with ! ' ( ) ~ percent-encoded", () => {+ const store = new LoginStore({ dataDir: dir });+ store.create({ ...at("example.com"), username: "alice", password: "Hunter2!(x)~", source: "settings", bots: "all" });+ const url = `https://example.com/login?${new URLSearchParams({ user: "alice", password: "Hunter2!(x)~" })}`;+ expect(new HeldSecrets(store).scrub(url)).toBe("https://example.com/login?user=alice&password=••••••");+ });+it("masks a one-time code only as a whole number, and only for a few minutes", () => {let now = 0;const held = new HeldSecrets(new LoginStore({ dataDir: dir }), () => now);diff --git a/server/login-store.ts b/server/login-store.tsindex b9358eefcc..bfd09d12d7 100644--- a/server/login-store.ts+++ b/server/login-store.ts@@ -287,6 +287,8 @@ export function secretForms(value: string): string[] {try {forms.add(encodeURIComponent(value));forms.add(encodeURIComponent(value).replace(/%20/gu, "+"));+ // A submitted form (application/x-www-form-urlencoded) also percent-encodes ! ' ( ) ~, which encodeURIComponent keeps.+ forms.add(new URLSearchParams([["", value]]).toString().slice(1));} catch {}return [...forms].filter((form) => form.length >= MIN_SECRET);}