mindtwo / craftcms-security-txt
Craft CMS plugin that serves an RFC 9116 security.txt per site, maintained in the control panel, with an expiry that follows the last save.
Package info
github.com/mindtwo/craftcms-security-txt
Type:craft-plugin
pkg:composer/mindtwo/craftcms-security-txt
Requires
- php: ^8.0.2
- craftcms/cms: ^4.0|^5.0
- mindtwo/base-security-txt: ^1.0
Requires (Dev)
- laravel/pint: ^1.13
- pestphp/pest: ^2.34|^3.0|^4.0
- phpstan/phpstan: ^1.11|^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-05 11:56:24 UTC
README
Craft CMS plugin that serves /.well-known/security.txt
(RFC 9116) per site, maintained in the control panel
under security.txt.
- Confirmed validity —
Expiresis one year after the details were last confirmed (built onmindtwo/base-security-txt). The form ends with the validity and a Confirm details button that stores the fields and renews the validity for one year; Save changes in the header stores them and keeps the date. The very first save publishes the file. Nobody edits a date, and a file nobody confirms expires. - Reminder — from 30 days before expiry, users with access see a control panel alert on every page with a Check now link to the security.txt page.
- Editable in production — the content lives in the plugin's own table, not in project config,
so it works with
allowAdminChangesdisabled. Access is granted with the regular Access security.txt user permission. - Fields — Contact (required, one per line: e-mail,
+phone number or https URL), Policy, Encryption, Acknowledgments, Hiring, Preferred languages.Canonicalis added automatically on https sites. - Safe defaults — invalid input is rejected with field errors and the published file stays
unchanged; without a contact the URL answers 404.
/security.txtredirects (301) to the well-known path. - Multi-site — one file per site, with a site switcher in the control panel.
- English and German interface.
Installation
composer require mindtwo/craftcms-security-txt php craft plugin/install mindtwo-security-txt
Then open security.txt in the control panel, enter the contact and save.
Requirements: Craft CMS 4 or 5, PHP 8.0.2+.
Notes
- A route for
.well-known/security.txtorsecurity.txtinconfig/routes.phpwins over the plugin. When switching from such a project-level solution, remove the route after entering the contact in the plugin. - Responses are sent with
Cache-Control: public, max-age=3600, so a CDN shows changes within an hour at the latest.
Development
composer install
composer check # pint --test, phpstan (level 8), pest
Inside the monorepo the core resolves through the path repository base-security-txt; CI removes it
when the package is built standalone.
License
MIT, see LICENSE.md.