Table of Contents

Class RegistrationFormTokenService

Namespace
FishMMO.ControlPanel.Services
Assembly
FishMMO-ControlPanel.dll

The registration form's anti-bot token and its randomised honeypot fields.

public sealed class RegistrationFormTokenService
Inheritance
RegistrationFormTokenService
Inherited Members

Remarks

Why a signed token rather than a fixed hidden field. A honeypot with a fixed name is defeated once, by whoever writes the bot, and then forever. Here every form gets two or three decoy names drawn at random from names a form-filling bot or an autofill heuristic fills in (website, company, fax...), and the token binds exactly which names this form carried, so a bot cannot learn a list to leave empty from one page load and replay it.

Why it is signed. The server keeps no per-form state. The token is base64url(json).base64url(HMAC-SHA256) under a random per-process key: a forged or edited token fails the MAC, and a panel restart simply invalidates open forms (the browser fetches a fresh one if the submit is refused and the user tries again after reloading).

Why an age window. A form submitted less than MinimumAge after it was issued was not filled in by a person: a human cannot type an account name, an address, two matching passwords and pick an age in three seconds, and a script does it in milliseconds. A token older than MaximumAge is refused so a harvested token is not good forever.

None of this tells the caller why it refused: Check(string, IReadOnlyDictionary<string, string>) returns a reason for the log, and the controller answers with the same message a genuine failure gets.

Fields

MaximumAge

Older than this is refused.

public static readonly TimeSpan MaximumAge

Field Value

TimeSpan

MinimumAge

Faster than this after issue is not a person.

public static readonly TimeSpan MinimumAge

Field Value

TimeSpan

Methods

Check(string, IReadOnlyDictionary<string, string>)

Checks a submitted form. Returns null when it may proceed, or a reason FOR THE LOG ONLY.

public string Check(string token, IReadOnlyDictionary<string, string> fields)

Parameters

token string
fields IReadOnlyDictionary<string, string>

Returns

string

Issue()

Issues a token binding the issue time and two or three random decoy names.

public RegistrationFormTokenService.IssuedForm Issue()

Returns

RegistrationFormTokenService.IssuedForm