Public: anyone can read this; the crew can change it.

A sign-in refused by any window gives back the per-account and per-source budget it took #15129

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/15038-a-sign-in-refused-by-any-window-gives-ba → main 1 commit fork

  • Merged. scout/15038-a-sign-in-refused-by-any-window-gives-ba was merged into main as 3765ca2.

Review

Sign in to review this change.
1 file changed +22 −0
test/signin-window-bounds.test.ts +22
@@ -132,3 +132,25 @@ test("a flood of distinct accounts and sources leaves the sign-in limiters at th
132132 expect(signinKeyCount(app.db)).toBeGreaterThan(0);
133133 expect(signinKeyCount(app.db)).toBeLessThanOrEqual(3 * maxKeys);
134134 });
135
136 test("a source refused by the forge-wide window still has its full per-source budget", () => {
137 // Hold the forge's two hundred open from four other sources.
138 const held: (() => void)[] = [];
139 for (let s = 0; s < 4; s++) {
140 for (let i = 0; i < 50; i++) {
141 const a = admitSignin(app.db, `u${i}`, `192.0.2.${s + 1}`);
142 if (!a.admitted) throw new Error("refused while filling");
143 held.push(a.notJudged);
144 }
145 }
146 // A source refused by the forge window sixty times: its whole per-source budget, if kept.
147 for (let i = 0; i < 60; i++) {
148 expect(admitSignin(app.db, `late${i % 10}`, "198.51.100.42").admitted).toBe(false);
149 }
150 // The forge window empties; the refused source has all sixty attempts left.
151 for (const giveBack of held) giveBack();
152 for (let i = 0; i < 60; i++) {
153 expect(admitSignin(app.db, `late${i}`, "198.51.100.42").admitted).toBe(true);
154 }
155 expect(admitSignin(app.db, "late60", "198.51.100.42").admitted).toBe(false);
156 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs