Install

Works with Drupal: ^11.4 || ^12

Using dev releases is not recommended, except for testing.

Using Composer to manage Drupal site dependencies

Alternative installation files

Download tar.gz 99.17 KB
MD5: c199e37c8e5ab1393facf417e932be6e
SHA-1: 4154bc7334c98d8be26d2aa706771c18c55790bb
SHA-256: 303c5ce1effdc944159a28882b3a98076a4142517e03db6e865406d6b7274448
Download zip 155.24 KB
MD5: 0fa53e69c9e3b9741b1dd80b2c62f4b4
SHA-1: 0c3905f1831e5538db86b590bb7a75edb4f58c7f
SHA-256: 90c807e3a3a6242636bec3090f79b7a1c78d98eefef3842977f3d76a03c09683

Release notes

Initial release. File Gate denies anonymous access to private:// files and delivers them only to visitors who have passed a gate — a lead form, a login, a token — through short-lived signed URLs that work with any front end.

Out of the box, Drupal grants a private-file download to anyone who can view the entity that references it; because anonymous users can view published content, a private file attached to published media is effectively public to anyone who has the link. File Gate closes that gap.

This release provides

  • Deny by default. A hook_file_download() veto for private:// files referenced by a gated field (overriding core's permissive access), for everyone except staff holding the "Bypass file gate" permission.
  • Decoupled delivery. A trusted back end mints a short-lived, HMAC-signed URL (POST /api/file-gate/mint) that the browser redeems (GET /api/file-gate/download). Fully front-end-agnostic; the raw /system/files path stays denied and the private:// path is never disclosed.
  • Pluggable gate methods. A GateMethod plugin type decides how a request proves it passed the gate. Ships with Signed URL (HMAC) and Authenticated access; add your own (token, email capture, one-time password, …).
  • Per-field configuration. Mark any private file or image field "gated" where you choose its storage; enabling gating forces and locks the private file system.
  • Expiry and usage controls. Per-field TTL, an absolute "available until" window, and usage limits — including one-time links. Every constraint is bound into the signature and cannot be altered by the client.
  • Media-optional. Gate a Media source field, a plain file field, or any other private file field. The only hard dependency is core File.
  • Fails closed. With no signing secret configured, minting returns 503 and every gated file is denied.
  • Constant-time verification, a dedicated logging channel (security and usage events), and an admin dashboard (secret status, global defaults, and a gated-field overview).

Requirements

  • Drupal 11.4+ (built on core's FileReferenceResolver API).
  • A configured private file system and a signing secret injected from the environment.

Documentation: the module README, plus docs/ADR.md and docs/API.md.

Created by: jmcerda
Created on: 13 Jul 2026 at 02:53 UTC
Last updated: 23 Jul 2026 at 23:51 UTC

Other releases