UnderAttack
in package
Gates anonymous front-end page views behind an interstitial proof-of-work challenge while under-attack mode is active. See the module-5 design spec.
Table of Contents
Constants
- COOKIE = 'creationell_captcha_ua_pass'
- The pass cookie name.
- FIELD = 'creationell_captcha_ua'
- The interstitial form field carrying the solved challenge.
Methods
- run() : void
- Runs the under-attack gate. Registered on `template_redirect`. Terminates the request when an interstitial is served or a pass redirect is issued.
- argon2id_worker_snippet() : string
- Returns the inline Argon2id worker-registration script, or '' when the Argon2id algorithm is not in use.
- has_valid_pass() : bool
- Whether the request carries a valid, unexpired pass token.
- issue_pass() : bool
- Mints a fresh pass token and sets it as a cookie.
- serve_interstitial() : void
- Outputs the interstitial page with HTTP 503 and terminates.
Constants
COOKIE
The pass cookie name.
private
mixed
COOKIE
= 'creationell_captcha_ua_pass'
FIELD
The interstitial form field carrying the solved challenge.
private
mixed
FIELD
= 'creationell_captcha_ua'
Methods
run()
Runs the under-attack gate. Registered on `template_redirect`. Terminates the request when an interstitial is served or a pass redirect is issued.
public
run() : void
argon2id_worker_snippet()
Returns the inline Argon2id worker-registration script, or '' when the Argon2id algorithm is not in use.
private
argon2id_worker_snippet() : string
Return values
stringhas_valid_pass()
Whether the request carries a valid, unexpired pass token.
private
has_valid_pass() : bool
Return values
boolissue_pass()
Mints a fresh pass token and sets it as a cookie.
private
issue_pass() : bool
Return values
bool —True when the cookie was set; false when headers were already sent and it could not be.
serve_interstitial()
Outputs the interstitial page with HTTP 503 and terminates.
private
serve_interstitial() : void