Check provider logo

Cloudflare Worker plain text and JSON bindings do not contain secrets

workers_script_no_secrets_in_plain_text_bindings

Severityhigh
Serviceworkers
by Prowler

Cloudflare Workers scripts are assessed for hardcoded secrets by scanning the values of plain_text and json bindings (environment variables) for credentials such as API keys, tokens and passwords.

Risk

Plain text and JSON bindings are stored unencrypted and shown in the dashboard, API responses and deployment tooling.

  • Confidentiality: anyone with read access to the account or the Wrangler configuration can harvest credentials
  • Integrity: leaked credentials enable unauthorized access to downstream services
  • Lateral movement: secrets are often reused across environments
Run this check with Prowler CLI

prowler cloudflare --checks workers_script_no_secrets_in_plain_text_bindings

Recommendation

Store credentials as Worker secrets (secret_text) or in Secrets Store, never as plain text variables.

  • Rotate any credential that was exposed in a plain text binding
  • Keep secrets out of wrangler.toml and source control
  • Apply least privilege to the credentials used by Workers

Remediation

Terraform
Other
  1. Log in to the Cloudflare dashboard and select your account
  2. Go to Workers & Pages and select the Worker
  3. Open Settings > Variables and Secrets
  4. Delete the plain text variable that holds the credential
  5. Add it again with type Secret (or run wrangler secret put <NAME>)
  6. Rotate the exposed credential

Source Code

Resource Type

Worker

References