M1 (4): forms.turnstileOnConfigError — a form with files is refused while Turnstile cannot check

While Turnstile is degraded (wrong or missing secret, Cloudflare down) a text
form is still accepted, as before; a submission to the file endpoint is refused
by default. forms.turnstileOnConfigError sets it for every form or per kind
('allow' | 'reject' | { text, files }); a value at a call site still wins.
Nothing changes when Turnstile is off. The gates and the resolver are exported
from the server entry.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 00:39:12 +01:00
co-authored by Claude Fable 5.2
parent 42fdad8c2d
commit 463fd5d664
7 changed files with 170 additions and 9 deletions
+5
View File
@@ -587,6 +587,11 @@ export const ipalKit = (options: IpalOptions): Plugin => {
if (options.forms.consentFieldName) {
config.custom = { ...config.custom, ipal: { ...config.custom?.ipal, consentFieldName: options.forms.consentFieldName } }
}
// what a form does while Turnstile cannot check — read by passTurnstile when the call site gives none
if (options.forms.turnstileOnConfigError) {
const ipal = (config.custom?.ipal ?? {}) as { forms?: object }
config.custom = { ...config.custom, ipal: { ...ipal, forms: { ...ipal.forms, turnstileOnConfigError: options.forms.turnstileOnConfigError } } }
}
}
// --- globals ---