Why this matters
Leaked secrets can expose PHI and encryption material.
Access tokens, HMAC salts, and KMS keys for PHI flows must come from a secret manager or encrypted credentials store; forbid committing secrets or .env files to the repo.
Leaked secrets can expose PHI and encryption material.
Side-by-side examples engineers can pattern-match during review.
HMAC_SALT = "dev-salt-123" # committed
ENV['KMS_KEY_ID'] = 'hardcoded'salt = Rails.application.credentials.dig(:phi, :hmac_salt)
kid = Rails.application.credentials.dig(:kms, :key_id)API_KEY='abc123' # in repoRails.application.credentials[:phi][:hmac_salt]From the same buckets as this rule.
Before persisting ePHI, encrypt using a data key protected by a Key Management Service (KMS). Use authenticated encryption (AES-256-GCM or equivalent), rotate keys, and store the key id and algorithm with the record.