Docs: Security

Security

The security Tilspire ships with by default — enforced CSP, hardened sessions, prepared statements, role-based permissions, 2FA, a movable admin panel and private ticket links.

The security Tilspire ships with, out of the box, on every install.

Content Security Policy #

Tilspire ships with an enforcing Content Security Policy. Every script, stylesheet and font the admin panel needs is self-hosted, so the interface doesn't depend on a third-party CDN to load. Images may load from any https: address, and choosing Turnstile as the CAPTCHA adds challenges.cloudflare.com. Since 1.19.0 the admin panel's script policy no longer allows inline scripts. To let the public site load a script, frame or image from another site, add its address under System ▸ Settings ▸ Security, in Additional allowed sources. It never loosens the script policy of the admin panel. Since 1.20.2 the policy also allows connections to region1.analytics.google.com and stats.g.doubleclick.net, the two hosts Google's analytics tag reports to; check a real ID's reports the first time you set one.

Two-factor sign-in for every account #

Staff and members alike can turn on two-factor sign-in with any authenticator app, with recovery codes for a lost phone. The secret behind it is stored encrypted, under a key kept in your site configuration rather than the database, so a copy of the database alone doesn't reveal it. An administrator can reset another person's lost second factor after confirming their own password and code; the reset signs that account out everywhere and emails its owner.

Since 1.19.0 "confirm it's you", the fresh proof asked before you close an account or change its password, email address or second factor, accepts a passkey or a linked sign-in provider as well as the password. A password reset also asks for the second factor when the account has an authenticator code.

Since 1.20.0 the panel's "confirm it's you" dialog offers your passkey first, with password and code beside it. Issuing an Operator API credential, or rolling one that has expired, still needs the authenticator code. Ask for two-factor again at the control panel removes the 5-minute grace after two-factor on the site, and a passkey satisfies it.

Hardened sessions #

Session cookies are HttpOnly, SameSite, and marked Secure over HTTPS. Signing in issues a fresh session id, so a session token captured before sign-in can't be reused after it. Resetting a password, changing it, or changing the account's email address signs the account out everywhere else.

Since 1.14.0 the admin panel has its own sign-in inside your site session. It asks for your password even when you're signed in on the site. The second factor is skipped only if you passed it on the site within the last 5 minutes, from the same address. It also asks again after a while without use: 30 minutes by default, set under System ▸ Settings ▸ Security. There, Always ask for the code at the control panel turns the skip off; staff without a second factor then can't sign in until they set one up. Making the idle time longer asks for your password and code. See The admin panel.

Sessions are kept in site/sessions/, which Tilspire refuses to serve. A host that backs up your web space would copy them too; to keep them elsewhere, set SESSION_SAVE_PATH in site/config/config.php to a folder outside it.

Passwords and sign-in #

One password policy applies everywhere a password is set, and a stored password hash is upgraded the next time its owner signs in. Failed sign-ins are throttled per address and per account, slowing down password guessing without letting a stranger lock you out.

Since 1.19.0 a password needs at least 12 characters when it is set or changed. Passwords that exist already keep working until their owner changes them.

Passkeys and sign-in with Google, Apple or Facebook #

Since 1.19.0 members and staff can sign in with a passkey, to the site and to the admin panel, and you can offer sign-in with Google, Apple or Facebook. Each is switched on and set up under People ▸ Member settings. The password is always on, so no setting here can lock everyone out.

  • A passkey is a fingerprint, face or device PIN in place of a password. Since 1.20.0 signing in and adding a passkey ask the device to check the person (PIN, fingerprint or face), so a passkey counts as password and second factor in one and signs in on its own, even where two-step sign-in is on. A device that cannot check its user can no longer sign in with a passkey; the person uses the password.
  • A passkey belongs to the site's address. If the address moves to another host, no passkey works any more until members add new ones; Health warns you, and members can still sign in with their password. Since 1.20.2 each passkey records the address it was made under, so a key made after a move counts as a second factor, and the panel's sign-in offers only keys that can answer at the current address. Health names an old address only while keys are stranded under it. A key made before 1.20.2 records its address the first time it signs in.
  • A provider's address is never linked to an existing account automatically. A member links it after confirming it's them, and is emailed when it happens. The last way in is never removed: a provider can be disconnected only while the account keeps a password, a passkey or another provider.
  • Turning a method on, or changing a provider's keys, asks for your password and code. Turning one off never does. A provider's secret keys are stored encrypted and are never shown again.

Since 1.18.0 you choose what members sign in with under People ▸ Member settings (before 1.19.0, Settings ▸ Security), in Members sign in with: username or email, username only, or email only. It applies to the public sign-in form only. The admin panel always accepts both.

Sign-ups #

Since 1.17.3 the sign-up form stops bots before an account exists. It carries a hidden field a person never sees, and checks that the form was neither sent back too quickly nor long after it was shown. Once you turn on a captcha (below), it is checked on your server too. A refused sign-up gets one plain answer that doesn't say which check failed, and sign-ups are also limited per address.

Since 1.19.0 sign-up can be closed, and the sign-up form can show a line agreeing to your terms and privacy pages.

Every role except Administrator can be limited to a number of topics, replies, comments and Tracker entries a day and an hour. Set them on the role, under Roles on the Limits and access tab. New members start with a safe default. People ▸ Member settings only decides who counts as new.

A bot that gets through still never confirms its email address. Tilspire removes member accounts left unconfirmed for a number of days, 7 by default: only ones that never signed in and have written nothing, and never staff. It is on for new sites; a site updated from an earlier release switches it on under People ▸ Member settings. Health shows whether both are in place.

A captcha of your choice #

Since 1.18.0 you choose reCAPTCHA v2, reCAPTCHA v3 or Cloudflare Turnstile under System ▸ Settings ▸ Security, each with its own keys. Once a captcha is on, sign-up asks, and so do new tickets and replies; sign-in and password reset can ask too, and both are off by default. Guest comments have their own switch in the Comments settings. Two things to know before you turn them on:

  • An outage at the provider is never treated as a pass, so while it lasts, members can't sign in.
  • reCAPTCHA v3 and Turnstile check which site a token was made for, so the site must answer on one address only: redirect www to the bare domain, or the other way round.

The admin sign-in never asks for a captcha, and accepts only accounts that may use the admin panel.

The admin panel's address #

Since 1.20.0 a new site's admin panel lives at /panel. An older site keeps the address it has, /adm unless you moved it. Since 1.18.0 you can give it another address under System ▸ Settings ▸ Panel, in Control panel address (before 1.21.0 it was on General). You confirm with your password and two-step code, then open the new address within 15 minutes to finish the move. Every panel account is then mailed the new address. Once moved, /adm is an ordinary missing page.

If the address is ever lost, there are three ways back:

  1. The mail. Every panel account was sent the new address when the move finished.
  2. The database. The address is stored in the settings table under the key admin_address. Deleting that row puts the panel back at /adm.
  3. The config file. Add define('ADMIN_ADDRESS', 'adm'); (or any valid address) to site/config/config.php. It wins at once, even without the database, and Settings then shows the address read-only until you remove the line.

View as, logged #

Staff with the "View as" permission can see the public site as a member, a role or a guest. It is look-only: nothing can be sent while viewing. Staff can only view as a role ranked no higher than their own, whose permissions they hold themselves. Every view is written to the activity log when it starts and when it ends.

In Feedback, ticket links no longer contain the client's email address. Each ticket has its own private link; opening it lets that browser into the ticket and removes the key from the address bar. "Check ticket status" emails the client a fresh link. Attachments open only for the ticket's client and for staff who manage tickets, never straight from the uploads folder.

Closing an account #

Members can close their own account, confirming with their password and, if two-step sign-in is on, their code. Accounts whose role holds any permission can't close themselves this way and ask an administrator instead. Since 1.19.0 closing can wait: set a number of days under People ▸ Member settings, and the person can undo it from a Cancel closing page until then. With 0 the account is removed at once, as before. One line in the activity log records it. Forum posts and comments stay, shown as "Former member".

Links that confirm an email address or reset a password only open a page; nothing happens until you press its button. Mail systems that open every link to scan it can't use them on your behalf.

Since 1.21.0 every emailed link (confirming an address, resetting a password, approving an address change, the digest's off link, and the panel's own reset link) hands its token only to the browser that opened it, through a cookie that lasts 10 minutes, so a copied session cookie cannot take it. A link opened a second time, or after ten minutes, answers "open it again". Ask the current inbox before an email address changes is on after the update.

Roles and permissions #

Admin access is governed by roles and a permission catalogue, not a single all-or-nothing account level. Give an editor exactly the permissions they need, and nothing else. Nobody can manage an account whose role ranks above their own.

Since 1.19.2 each role can also be switched off from posting links in comments, forum posts and Tracker entries (links to your own site always work) and from having a profile picture, banner or website. A hidden picture is kept, not deleted. Set them on the role, under Roles on the Limits and access and Profile tabs.

Since 1.19.0 every Settings page and tab has its own permission, modules' settings included, so a role can manage mail without seeing security. Nothing was lost at the update: each role got the new permissions for what it could already manage. Since 1.21.0 the Panel tab has its own permission, manage_settings_panel; every role that could manage System settings was given it, and System now covers only maintenance, time and language. The User role is merged into Member, and you choose which role new sign-ups get; see Members and roles.

Prepared statements #

Every database query goes through parameterised, prepared statements. User input is never concatenated into SQL.

Content sanitisation #

Content saved through the editor is sanitised before it's stored, so pasted or injected markup can't carry scripts or unsafe attributes into your pages.

Protected files #

The .htaccess file Tilspire ships with refuses requests for hidden files, configuration, backups, logs and archives, and the configuration file is written readable by its owner only. Behind nginx, mirror those rules in the server configuration, including one that refuses site/sessions/ and, since 1.15.0, site/drafts/, where images an agent proposed wait for review. Since 1.18.0 Feedback's ticket uploads need one too:

location ^~ /uploads/tickets/ { return 404; }

Since 1.20.0 files that must never have a public address live in one protected store, uploads/private/, and open only through the site, which asks the module whether this reader may see the file. Tracker attachments are the first to use it. Behind nginx it needs its own rule:

location ^~ /uploads/private/ { return 404; }

Health warns if either folder can still be opened directly. Since 1.20.2, on a host that ignores .htaccess, Health shows these folders and site/drafts/ amber rather than red: their file names are hard to guess, though not secret, and the rules above are what close them. Red stays for PHP that can run from a file under uploads/. Every protected folder also holds a blank index.html, so such a host shows a blank page rather than a list of files.

Since 1.19.0 the old flat media addresses have one more optional nginx rule; it is in Requirements.

HTTP caching #

Since 1.18.0 Tilspire tells browsers and any CDN in front of it what they may keep.

  • An anonymous page that answers 200 is sent public, no-cache with a strong ETag, so a cache must ask before it reuses the page. When the ETag still matches, Tilspire answers 304 and sends no page.
  • Personal pages, such as a member's account, are sent private, no-store.
  • Static files whose address carries ?v= are cached for a week (max-age=604800); those without it for an hour (max-age=3600). The root .htaccess sets both. Behind nginx, see Requirements.
  • Settings ▸ Performance has cdn_max_age, how long a CDN may serve an anonymous page without asking again: 0 to 300 seconds, 0 by default.

Signed updates #

Every update is checksummed and signature-verified before it's applied — see Updates. Since 1.21.0 the update feed and every package must be fetched over HTTPS, redirects included, and release-channel promotions are signed too.

Outbound requests, webhooks and social posting #

Since 1.21.0 webhooks, content sync and social posting share one list of forbidden destinations: private address ranges, ::ffff:0:0:0/96, links with a user part, and ports above 65535. Outbound webhooks are signed (Standard Webhooks, HMAC-SHA256), and adding one needs two-factor sign-in on and a "confirm it's you". Social posting keys are stored sealed under SOCIAL_KEY in your site configuration.

Bans and direct messages #

Since 1.21.0 sign-up blocks are stored as hashes only, so the list reveals nothing at a glance. A domain or an IPv4 address can still be found by guessing, and the privacy page says so. In direct messages, links show as plain text, and a reported message can be read only through a logged read. Pictures are stored as WebP in protected files.

The Operator API stays off #

The Operator API is off until an administrator turns it on. Its credentials expire, act only as the account that issued them, and propose changes that a person approves. Only the credential's owner can let it publish its own pages, posts and images for a while, from a short list of addresses, with every change undoable — see Operator API.

Backups you can trust #

Every update takes an encrypted snapshot of the database first. Off-site backups are encrypted before they leave your server, and each copy is proven by a nightly restore test. Since 1.20.2 a scheduled backup's file name carries random characters after its date and time, so it cannot be guessed on a host that ignores .htaccess; the update renamed older ones the same way.