This project is not covered by Drupal’s security advisory policy.
Environment Guard will keep a non-production copy of a site from acting like production after a database clone: rerouting or blocking mail, blocking calls to production-only hosts, stopping chosen cron jobs and queues, forcing payment gateways into test mode, and refusing webhooks that belong to another environment.
Status: No release yet. The module is under active development; the first beta follows once its automated test suite and an independent review pass.
This module is developed with AI assistance. The maintainer reviews and tests every release before publishing it.
Planned for 1.0
None of this is released yet. The first release will provide:
Knowing which environment it is
- The environment's identity taken from the runtime, never from the database: from
$settingsin settings.php, or from the environment variables that Pantheon, Acquia, Platform.sh/Upsun, DDEV and Lando set. A cloned database cannot bring production's identity with it. - Policy kept in configuration, with a value for each environment.
Policies
- Mail: allow it, reroute it to listed addresses with the original recipients kept in headers, or block and log it. Designed to work with Mail System and Mailer Plus (symfony_mailer).
- Outbound HTTP: a Guzzle middleware with allowlist and denylist host patterns, so production-only hosts cannot be called from other environments.
- Cron and queues: chosen cron jobs and queue workers disabled per environment.
- Payment gateways: Commerce payment gateways forced into test mode through a configuration override, so nothing is written to the database.
- Webhooks: listed webhook routes, by route name, refused on environments that do not own them.
Checks
drush environment-guard:check, to run after a database clone. It reports the active policies and dangerous configuration, such as API keys that look live outside production, and exits non-zero when it finds danger.- Status report entries.
- A design that sits alongside Environment Indicator without duplicating it.
Requirements
Planned for the first release:
- Drupal 11.3 or later, or Drupal 12.
- PHP 8.3 or later.
- No other modules. The mail policy works with Mail System and Mailer Plus when they are installed, and the payment policy applies when Drupal Commerce is installed.
Installation
Installation instructions arrive with the first release. For the first beta, the commands will be:
composer require 'drupal/environment_guard:^1.0@beta' drush en environment_guard
Configuration and permissions
Not final yet. This section will list each settings page and each permission, by its real label, with the first release.
Similar projects
Checked on drupal.org in November 2026.
- Reroute Email reroutes outgoing mail to chosen addresses. Choose it if mail is all you need to control. Its Drupal 11 support is in a 2024 release candidate.
- Environment Indicator shows which environment you are on. It enforces nothing; use it together with this module.
- Production check & Production monitor checks whether a site is set up safely for production. Its releases go up to Drupal 10, and it is seeking a new maintainer.
- Configuration Split keeps different configuration for each environment, applied when configuration is imported. It is the right tool for per-environment configuration in general; until the next import, a cloned database still runs production's configuration.
Support and maintenance
Report bugs, ask for features and comment on the planned scope in the issue queue. Each release will have notes describing what changed.
This project is not covered by Drupal's security advisory policy. Until it is, security issues are handled in the public issue queue and fixed in ordinary releases.
A read-only mirror is on GitHub at DanePete/drupal-environment-guard. It will mirror the drupal.org repository once code is published there; development and issues stay on drupal.org.
Maintainer
Created and maintained by deadnorth (Dead North).
Project information
- Project categories: Administration tools, Developer tools, Security
- Created by deadnorth on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
