Ruby on Rails Secret Credentials

Detects secret credentials embedded in Ruby on Rails configuration files: secret_token/secret_key_base assignments (config/initializers/secret_token.rb, config/secrets.yml), database passwords (config/database.yml), and Chef knife client keys (knife.rb). These files are frequently committed to source control and expose application secrets and infrastructure access. Mirrors Snaffler rule KeepRubyByName.

Type
regex
Engine
boost_regex
Confidence
medium
Confidence justification
Medium confidence: secret_token and secret_key_base are Rails-specific field names with highly constrained hex values, making false positives rare. The database.yml password form is intentionally generic and depends on evidence gating (adapter, production block) for precision. knife.rb client_key is specific to Chef tooling. Combined, the pattern family covers the majority of Rails-stack secrets found in source repositories.
Jurisdictions
global
Regulations
GDPR, Criminal Code Act 1995 (Cth)
Frameworks
CIS Controls, ISO 27001, NIST CSF, PCI-DSS, SOC 2
Data categories
credentials, security, application-secrets
Scope
specific
Risk rating
9
Platform compatibility
Purview: Compatible, GCP DLP: Compatible, Macie: Compatible, Zscaler: Compatible, Palo Alto: Compatible, Netskope: Unsupported

Pattern

secret_(?:token|key_base)\s*=\s*['"][a-f0-9]{30,}

Corroborative evidence keywords

production, adapter, secret_key_base, Rails.application, database.yml, secret_token, knife.rb, api key, api_key, apikey, access key, access token, auth token, authorization, bearer, conn str, connection string, connectionstring, cookie, credential (+40 more)

Proximity: 300 characters

Should match

Should not match

Known false positives

Collections