Search by

drupal / mutamad_security

Drupal-Infrastructure

The security baseline for Mutamad: password policies, account lockout and idle logout; security headers and a Content Security Policy, private uploads by default, no error output to visitors, anti-automation on login and the public forms, flood unblocking and cheap 404s. Aligned to NCA ECC-2:2024 2-

Package info

git.drupalcode.org/project/mutamad_security.git

Homepage

Issues

Type:drupal-recipe

pkg:composer/drupal/mutamad_security

Statistics

Installs: 61

Dependents: 1

Suggesters: 0

1.0.x-dev 2026-11-12 17:39 UTC

This package is not auto-updated.

Last update: 2026-11-16 06:04:19 UTC


README

Mutamad Security — الأمان

Mutamad Security

The security baseline for Mutamad: who can do what, how accounts and logins are protected, and how the site protects itself. Aligned to NCA ECC-2:2024 2-2, 3-2 and 15-2.

Built and maintained by iSpectra.

Accounts and login

ControlWhatNCA ECC
RolesThe three job roles of Mutamad Roles, applied first: content_editor writes, content_approver publishes, site_admin runs the site, its accounts and its evidence. The password policies and role assignments here name them1-3-1, 2-2
Delegationsite_admin assigns the editor role only, through Role Delegation, without administer permissions. Approvers and site administrators are made by the administrator, so nobody can make a second account to approve their own work1-3-1, 2-2
PasswordsStaff (editor): 12+ characters, 3 character types, last 5 not reused, changed yearly. Privileged roles: 14+, 4 types, last 12 not reused, at most 3 repeated characters, changed every 90 days2-2-3
AccountsRegistration by administrators only; email verified; a cancelled account is blocked and its content unpublished; reset links last 24 hours2-2-3
Brute force5 attempts per IP and 3 per account every 30 minutes; an account is blocked after 5 wrong passwords until an administrator unblocks it; the login error never says which part was wrong; login and reset answer the same whether or not an account exists2-2-1
Login and reset formsALTCHA: a proof-of-work check in the visitor's browser, no outside service; Honeypot and Antibot on password reset and registration15-2
Flood blockssite_admin sees and releases the addresses and accounts held by the flood limits2-2
SessionsLogged out after 15 minutes idle and after 2 hours at most, administrators included2-2-4

Multi-factor authentication is not in this recipe. It lives in mutamad_crypto, beside the key that encrypts every user's MFA secret, and is required for the privileged roles.

The site

ControlWhatNCA ECC
Error outputErrors are logged, never shown to visitors3-2-1
Uploadsprivate is the default file scheme; files are refused when their name could make the server run them3-2-3
Content Security PolicyScripts from the site only; no plugins; frames from the site, YouTube and Vimeo only; the site framed only by itself; plain HTTP requests upgraded15-2
Response headersStrict-Transport-Security (two years, subdomains), X-Frame-Options: SAMEORIGIN, Referrer-Policy: strict-origin-when-cross-origin, Permissions-Policy (no camera, microphone, payment or USB; location for the site only)3-2-2, 8-2
Cross-site postsA form posted from another site is refused15-2
HoneypotBlocked submissions are logged15-2
Public formsAntibot on password reset, registration, contact forms and comments — and, through mutamad_forms, every webform: a form is sent only from a browser running JavaScript, once a person has moved the mouse, touched the screen or pressed Tab or Enter. A bot that posts the form directly is refused. Logged-in staff skip it15-2
404sProbes for missing files (.asp, images, text files) get a bare 404, not a full page—

The Content Security Policy

It is strict on purpose. What it allows, and why:

  • script-src 'self', plus the hash of one inline script: core Navigation's, which restores the admin sidebar's state before the page is drawn. No other inline script runs. A core update that changes that script fails mutamad-verify (from the Mutamad project template) rather than quietly misbehaving.
  • style-src 'self' 'unsafe-inline': Drupal core, Gin and CKEditor 5 set styles inline.
  • child-src 'self' blob:: ALTCHA solves its challenge in web workers created from blob: URLs. Without it the check never finishes and nobody can log in.
  • frame-src 'self' https://www.youtube.com https://www.youtube-nocookie.com https://player.vimeo.com: Drupal shows a remote video in an iframe of its own /media/oembed page, which then frames the player.
  • img-src 'self' data:, font-src 'self' data:, connect-src 'self'.

Violations are reported to Security Kit's endpoint, /report-csp-violation, and written to the site log.

One thing it blocks on purpose: Project Browser's project logos, which come from git.drupalcode.org. Project Browser still works, without the logos; it belongs on development sites only.

Antibot, and who it can refuse

Until the page's script sees a person, a protected form points at Antibot's own page instead of its real address, and the key the form needs is kept scrambled in the page. A bot that posts the form directly, or follows the form as served, never sends the key and is refused.

Two kinds of visitor are refused too:

  • No JavaScript. The form's fields are hidden and the form says JavaScript is needed. The login and password-reset forms already need it for ALTCHA.
  • No pointer movement and no Tab or Enter. A visitor who fills a form in and sends it without either — as some screen-reader and voice-control set-ups do — lands on Antibot's page, which asks them to go back and try again. This is a known gap in Antibot 2.0 (#3406484); the module itself is not changed here.

Logged-in users skip Antibot on the forms listed here (skip antibot for authenticated): every account is created by an administrator, so a logged-in user is staff. Webform's setting for all webforms protects a webform for everyone.

Widening it

Maps, analytics, chat widgets and fonts from another domain are blocked until a site allows them. Do it deliberately, per source, and record why — at Configuration → System → Security Kit, or in the site's own configuration. Do not allow a public CDN (cdn.jsdelivr.net, cdnjs.cloudflare.com, unpkg.com): anything hosted there could then run on the site. Host the library instead, under /libraries. mutamad_forms turns off Webform's CDN libraries for this reason.

What it leaves alone

  • File fields that state their own scheme. Every one Mutamad ships — the image, SVG, document, audio and video media fields and the user picture — is public; the private default applies to fields created without a scheme.
  • HSTS preload is off. It only matters once the domain is submitted to the browsers' preload list, which takes months to leave.
  • Honeypot, CAPTCHA and Antibot are not on every form. The login form is left out of Honeypot for password managers, which fill it faster than the five-second limit, and out of Antibot, as ALTCHA already requires a browser there; CAPTCHA everywhere would put a challenge on the search box of every page and stop the page cache from serving anonymous visitors.
  • Security Review is not installed. mutamad-verify checks the controls this recipe sets. Security Review also fails to install beside TFA, which Mutamad uses for MFA: TFA's login service implements only the older interface, and Security Review 3.1 requires the newer one.
  • Error display on development environments. DDEV's settings.ddev.php shows errors; mutamad-verify reports that override without failing.

Fast 404 runs with its defaults. Its settings.php options are described in the module's example.settings.fast404.php.

Requirements

Drupal core 11.4. Composer brings everything else: Password Policy, Login Security, Automated Logout, Username Enumeration Prevention, Role Delegation, Security Kit, Permissions Policy, Flood Control, Honeypot, CAPTCHA, ALTCHA, Antibot and Fast 404.

The site must be served over HTTPS for HSTS and upgrade-insecure-requests to have any effect, and must have a private file path — Mutamad's installer sets one outside the web root.

Mutamad Roles, which this recipe applies first, creates the job roles. Other Mutamad recipes that grant to the roles apply Mutamad Roles, not this recipe, so applying one of them on its own does not bring this baseline.

Apply it to an existing site

Set a private file path in settings.php first, outside the web root. The recipe makes private the default scheme, and stops without one:

$settings['file_private_path'] = '../private';
composer require drupal/mutamad_security
drush recipe ../recipes/mutamad_security

Roles that already exist are kept and only gain permissions; recipes cannot remove one. Try it on a copy first: the account settings, flood limits, password policies and Content Security Policy all change how an existing site behaves. Test the pages it uses in a browser with the developer console open before going live: anything the policy blocks is reported there and in the site log.

Getting back in

An account blocked after 5 wrong passwords is unblocked like any blocked account: People → edit → Status: Active, or drush user:unblock NAME. An address held by the flood limits is released at People → Flood Unblock.

License

GPL-2.0-or-later.

Maintainers

iSpectra

Built and maintained by iSpectra (on drupal.org).