Key Audit finds potentially unsafe storage of API keys and other secrets in Drupal configuration and local files. Audit any site, including sites without the Key module, and get remediation guidance.
Useful for security reviews, deployment checks, and preparing configuration for version control. Ordinary scans are read-only; findings require human review.
Enable Key Audit, then run this command from your project root:
vendor/bin/drush key-audit:config --project-root="$PWD"
Review the findings and follow the suggested actions. There is currently no audit administration page. If Key is not enabled, the status report recommends it; audit reports also recommend it when possible stored secrets are found.
For DDEV file storage, copy both YAML files from examples/ddev into the project's .ddev directory and restart DDEV. Commit the copied configuration files to the project; each developer supplies their own credentials. The included guide and Drupal Help pages explain setup and migration. Staging and production require separate provisioning.
Requires Drupal 10.3 or later in the 10.x series, Drupal 11, or Drupal 12. Drupal 12 requires PHP 8.5 and Drush 14.x; Drupal 10/11 use a compatible Drush 12.5–12.x or 13.x release. The standalone scanner does not require Drush.
Key is not required for auditing. The optional Key Audit Fix submodule requires Key 1.22 or later in the 1.x series (1.23 or later on Drupal 12), PHP's POSIX extension, and suitable persistent private storage.
Key manages secrets through storage providers, compatible integrations, and configuration overrides. Installing it does not automatically migrate existing values: https://www.drupal.org/project/key.
Key Status tracks exposure assessments and remediation history for Key entities: https://www.drupal.org/project/key_status.
Security Review checks broader Drupal security settings. Key Audit focuses on secret storage and Key-provider configuration: https://www.drupal.org/project/security_review.
Contribute testing, documentation, bug reports, or provider integrations. Use invented credentials in examples; never post real secrets.
The included README and documentation cover commands, reporting, integrations, and remediation. Key Audit Fix includes a separate migration and recovery guide.