Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fill_login: decode the address before the sign-in page check

AdityaUmale06f4d3dfd9d0
diff --git a/server/login-fill.test.ts b/server/login-fill.test.ts
index 64095a3bfd..820493d1c8 100644
--- a/server/login-fill.test.ts
+++ b/server/login-fill.test.ts
@@ -354,7 +354,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/signup", oneBox], ["https://example.com/signin/reset-password", oneBox], ["https://example.com/login/registration", oneBox]]) {
+ for (const [url, html] of [["https://example.com/login", twoBoxes], ["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.ts
index a46a8aae88..413c61eaa6 100644
--- a/server/login-fill.ts
+++ b/server/login-fill.ts
@@ -174,7 +174,7 @@ 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 = location.pathname.toLowerCase().split("/");
+ const steps = (() => { try { return location.pathname.split("/").map((step) => decodeURIComponent(step).toLowerCase()); } catch { return []; } })();
const signIn = steps.some((step) => ["login", "log-in", "signin", "sign-in"].includes(step)) &&
!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] ||