Skip to content
Bisman.
Navigate
External
ProjectsProjects
Bisman.
Home›Case Studies›A Smart Approach to Managing Sensitive Credentials in Rails with Sekrets
Security

A Smart Approach to Managing Sensitive Credentials in Rails with Sekrets

Key Metrics

4 days
Implementation time
100%
Hardcoded secrets removed
$0
Additional cost
0
Repository exposure of secrets

Challenge

The client’s Ruby on Rails application contained hardcoded credentials (API keys, tokens) inside the source code. Storing secrets in plain text within the repository increases the chance of accidental leakage and complicates audits and compliance.

Solution

  • Repository scanning to identify all hardcoded secrets across .rb and .yml files.
  • Code refactoring to remove inline secrets and read values from an encrypted file managed by the Sekrets gem.
  • Secure storage of credentials in config/sekrets.yml.enc, with the decryption key stored safely outside the repository (e.g., a secrets vault/password manager).
  • Secure runtime access using SEKRETS[...] without invasive changes to the app structure.

Example: referencing secrets in YAML via ERB

some_service:
  api_key: <%= SEKRETS[:some_service_api_key] || 'fallback-if-missing' %>

Example: referencing secrets in Ruby

token = SEKRETS[:slack][:token]

Technologies

  • Ruby on Rails
  • Sekrets (encrypted YAML secrets)
  • Docker Compose (dev bootstrap)
  • Password manager (for .sekrets.key)
  • Secret-scanning tools (repo hygiene)

Results

  • Removed all hardcoded credentials from the codebase.
  • Significantly reduced risk of accidental credential exposure and improved auditability.
  • No meaningful cost impact; minimal developer disruption.

Key Metrics

  • Implementation time: 4 days
  • Hardcoded secrets removed: 100%
  • Additional cost: $0
  • Repository exposure of secrets: 0

Key Learnings

  • Always separate code and secrets; never commit plaintext credentials.
  • Keep the encryption key (.sekrets.key) out of the repository and rotate it per policy.
  • Use automated scanners to continuously prevent regressions.

Technologies & Tools

Ruby on RailsSeckretsEncryptionCredential ManagementSecret Scanning
← Back to All Case StudiesDiscuss Your Project →

© 2026 Bisman Singh. Built with passion for DevOps and automation.

Navigation

  • Home
  • About
  • Publications
  • Contact

About Sections

  • Experience
  • Tooling
  • Certifications
  • Education

Resources

  • Case Studies
  • Technical Guides