Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(login-fill): strip only known page extensions; check sign-up words on the full step
AdityaUmale1ae599eb4fed
diff --git a/server/login-fill.test.ts b/server/login-fill.test.tsindex 5a103d75c6..0baa51ec35 100644--- a/server/login-fill.test.ts+++ b/server/login-fill.test.ts@@ -353,7 +353,7 @@ describe("one-time codes and fields", () => {it("takes the only new-password box on a sign-in page whose path ends in a file name (login.html), as ccopyright's does", async () => {const boxes = `<div><input type="text" placeholder="请输入用户名/手机号/邮箱" autocomplete="new-password"><input type="password" placeholder="请输入密码" autocomplete="new-password"></div>`;- for (const url of ["https://register.example.cn/login.html", "https://example.com/account/signin.php", "https://example.com/Sign-In.aspx"]) {+ for (const url of ["https://register.example.cn/login.html", "https://example.com/account/signin.php", "https://example.com/Sign-In.aspx", "https://example.com/login.servlet", "https://example.com/login.do"]) {const { page, fill } = setup(url, boxes, [{ host: url.includes(".cn") ? "example.cn" : "example.com", username: "[email protected]" }], { submit: false });const outcome = await fill();expect(outcome).toMatchObject({ ok: true, filled: ["username", "password"] });@@ -366,7 +366,7 @@ describe("one-time codes and fields", () => {it("keeps new-password boxes empty on a sign-in page with two of them, or on a sign-up page under a sign-in path", async () => {const twoBoxes = `<form><input name="email" type="email"><input name="new" type="password" autocomplete="new-password"><input name="again" type="password" autocomplete="new-password"></form>`;const oneBox = `<form><input name="email" type="email"><input name="new" type="password" autocomplete="new-password"></form>`;- for (const [url, html] of [["https://example.com/login", twoBoxes], ["https://example.com/login.html", twoBoxes], ["https://example.com/login/signup.html", oneBox], ["https://example.com/login/signup", oneBox], ["https://example.com/signin/reset-password", oneBox], ["https://example.com/login/registration", oneBox], ["https://example.com/login/%72egistration", oneBox], ["https://example.com/login/%E0%A4%A", oneBox]]) {+ for (const [url, html] of [["https://example.com/login", twoBoxes], ["https://example.com/login.html", twoBoxes], ["https://example.com/login/password.reset", oneBox], ["https://example.com/login.register", oneBox], ["https://example.com/login.signup", oneBox], ["https://example.com/login/signup.html", oneBox], ["https://example.com/login/signup", oneBox], ["https://example.com/signin/reset-password", oneBox], ["https://example.com/login/registration", oneBox], ["https://example.com/login/%72egistration", oneBox], ["https://example.com/login/%E0%A4%A", oneBox]]) {const { page, fill } = setup(url, html, [{ host: "example.com", username: "[email protected]" }], { submit: false });const outcome = await fill();expect(outcome).toMatchObject({ ok: true, filled: ["username"] });diff --git a/server/login-fill.ts b/server/login-fill.tsindex 69fc7d7fd4..1f67bbac66 100644--- a/server/login-fill.ts+++ b/server/login-fill.ts@@ -174,8 +174,9 @@ const FIND_FIELDS = `((nonce, step) => {const passwords = rest.filter((el) => el.type === "password" && !isNew(el));const fresh = rest.filter((el) => el.type === "password" && isNew(el));// Some sign-in forms (TikTok's) mark their only password box new-password.- const steps = (() => { try { return location.pathname.split("/").map((step) => decodeURIComponent(step).toLowerCase().replace(/\\.[a-z0-9]{1,6}$/, "")); } catch { return []; } })();- const signIn = steps.some((step) => ["login", "log-in", "signin", "sign-in"].includes(step)) &&+ const steps = (() => { try { return location.pathname.split("/").map((step) => decodeURIComponent(step).toLowerCase()); } catch { return []; } })();+ const PAGE = /\\.(?:html?|xhtml|shtml|php|aspx?|jspx?|do|action|cgi|cfm|servlet)$/;+ const signIn = steps.some((step) => ["login", "log-in", "signin", "sign-in"].includes(step.replace(PAGE, ""))) &&!steps.some((step) => ["signup", "sign-up", "register", "registration", "join", "reset", "forgot", "change"].some((word) => step.includes(word)));const password = passwords.find((el) => tokens(el).includes("current-password")) || passwords[0] ||(signIn && fresh.length === 1 ? fresh[0] : null);