Vote budgets: monotonic windows, a key cap, 30 mints an hour and a readable 429
FixedWindowBudget times windows on the clock's monotonic timestamps so a wall-clock step cannot stretch or reset one, expires windows from a start-ordered queue instead of a periodic sweep, and holds at most MaxTrackedKeys keys: a new key at the cap is denied with the true wait and a held key is never evicted. MintPermits is 30 per hour per the operator ruling, and a 429 now carries a plain-text reason; a refused new device is told it can sign in. Not yet built or tested at this commit. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2c8384e44a
commit
a8c3ecf495
8 changed files with 219 additions and 61 deletions
|
|
@ -28,12 +28,19 @@ public sealed class ConceptVoteOptions
|
|||
|
||||
public TimeSpan CastWindow { get; init; } = TimeSpan.FromMinutes(10);
|
||||
|
||||
// Mint: a new device cookie is a new voter identity, the cheapest stuffing lever, and a household has few devices,
|
||||
// so 5 new devices per hour per network prefix.
|
||||
public int MintPermits { get; init; } = 5;
|
||||
// Mint: a new device cookie is a new voter identity, the cheapest stuffing lever. Anonymous visitors share an
|
||||
// address behind carrier, school and office NAT (the research note records it), so 30 new devices per hour per
|
||||
// address (operator ruling concept-mill-votes:ruling:mint-budget-30-per-hour); per-device and per-prefix cast
|
||||
// limits still bound stuffing.
|
||||
public int MintPermits { get; init; } = 30;
|
||||
|
||||
public TimeSpan MintWindow { get; init; } = TimeSpan.FromHours(1);
|
||||
|
||||
// The most partitions each budget holds at once. At the cap a partition not yet held is refused with a 429 until
|
||||
// the oldest window ends; held partitions are never evicted, so a rotating caller cannot escape a spent budget.
|
||||
// 100000 partitions is a few tens of MB; a real audience is far below it.
|
||||
public int MaxTrackedKeys { get; init; } = 100_000;
|
||||
|
||||
// The origins whose pages may read the public tally export from a browser (CORS). Each entry is exactly
|
||||
// https://host[:non-default-port], lower case, no path; empty allows none. StartupConfigurationValidator
|
||||
// refuses anything else outside Development and Testing, because "*" would allow every origin.
|
||||
|
|
|
|||
Loading…
Reference in a new issue