Install

Works with Drupal: ^11.4 || ^12

Using Composer to manage Drupal site dependencies

Alternative installation files

Download tar.gz 36.51 KB
MD5: 66e0c82c663ab483bbfd364a46797b23
SHA-1: f4139d4af6b69e6795b02f1b38dbfe5d03cdaefc
SHA-256: d814bb7ca0787f47367d6aa1e380cea8ae5873f0bc54ec277bf8637dfedbcafb
Download zip 55.05 KB
MD5: df9e353bc10bbfa952d34f863067a3ea
SHA-1: 6f86e191800bb01a67972c20b1f42fe246e75ce5
SHA-256: b9eb0a393546d0f40482fef40e2236892127bc50b1b9df2aaafa1a387730d365

Release notes

Initial beta 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.

Highlights

  • Deny by default. A hook_file_download() veto for private:// files referenced by a gated field, 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.
  • 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.

Beta note: the feature set and APIs are complete and covered by kernel tests, but the module has not yet had a stable release or opted into security-advisory coverage. Feedback and issue reports are welcome.

Created by: jmcerda
Created on: 13 Jul 2026 at 17:07 UTC
Last updated: 13 Jul 2026 at 17:07 UTC
Unsupported

Other releases