Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,113 of 9,113 pages
About the help in other languages
All help pages

CSRF form tokens

How Exponential protects every POST form against cross-site request forgery with the ezformtoken extension, what visitors see when a token is refused, the secret to set per project, and what to check in your own forms.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/government/building/forms/csrf-form-tokens.md

On this page

CSRF form tokens

This page is for administrators, website creators and developers who need to know how public and administration forms are protected against forged submissions. Exponential adds a secret token to every POST form and refuses posts without it; this is the ezformtoken extension in the kernel. Sources: Form expired page, Spam protection for forms and Security standards.

Contents

  1. What the token protects against
  2. What visitors see when a token is refused
  3. Settings
  4. Checks for your own forms
  5. Troubleshooting

What the token protects against

Cross-site request forgery: a page on another site makes a visitor's browser post to your site, using the visitor's session. With a token in every form, a post that did not come from your own page is refused. It protects:

  • the administration (every edit, removal, setting);
  • signed-in visitors' actions (profile changes, subscriptions);
  • public forms (information collector posts).

It is one layer of OWASP Top 10 A01 and A08 mitigations listed in Security standards. It does not stop a person, or a script that loads your form first, from sending spam; that is what Spam protection and third parties covers.

What visitors see when a token is refused

Since 27 September 2026 a refused post gets a clear page instead of an error:

PartValue
Messagethe form has expired; nothing was saved; reload the form and send it again
Status403 Forbidden (kernel error 6, error.ini)
HeadersCache-Control: no-store and the configured security headers
XHR with Accept: application/jsona JSON body with the same message
Logone line in var/log/warning.log with the check (missing or wrong), method, path and siteaccess, never the token

The page is design:error/kernel/6.tpl in design/standard; your design can override it. A form left open for a long time (a long consultation response) can expire; tell people to copy long texts before sending, or keep forms short.

Settings

FileBlockKeyDefaultDo
settings/site.iniHTMLFormsSecretThisTokenIsNotSoSecretChangeItset your own value in settings/override/site.ini.append.php; keep it out of version control
settings/site.iniHTMLFormsRefusalLogCollapseSeconds60repeated refusals within the window are counted, not written
settings/error.iniErrorSettings-kernelHTTPError[6]403leave it

Keep the ezformtoken extension active; the installer sets it up.

Checks for your own forms

  • To do: Forms post with method="post"; the token is added to POST forms of the page output.
  • To do: Forms built by JavaScript send the token too (read it from the page's form or meta data, as the shipped scripts do).
  • To do: No state-changing action is reachable by GET (a link that removes something).
  • To do: After a deploy, a form opened before still works or shows the "form expired" page, not an error.

Troubleshooting

SymptomCause
Every post is refused after a changethe secret changed while forms were open, or a cache served a page with an old token to many visitors; do not cache pages with forms for signed-in users
Refusals from one address in warning.logsomeone posting without loading the form; usually harmless, possibly an attack worth watching
A custom form is always refusedit is built outside the page output (an iframe, a static HTML file) and has no token

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x