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.tomland source control - Apply least privilege to the credentials used by Workers
Remediation
Terraform
Other
- Log in to the Cloudflare dashboard and select your account
- Go to Workers & Pages and select the Worker
- Open Settings > Variables and Secrets
- Delete the plain text variable that holds the credential
- Add it again with type Secret (or run
wrangler secret put <NAME>) - Rotate the exposed credential
Source Code
Resource Type
Worker