Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Don't Commit Your Secrets

Don't Commit Your Secrets

How to keep your application 
secrets safe

Nicholas Henry

June 17, 2014
Tweet

More Decks by Nicholas Henry

Other Decks in Programming

Transcript

  1. Your secrets are everywhere • Passwords • Credentials • API

    Keys • Database • Amazon S3 • Stripe • Mail Chimp Examples Synonyms
  2. • Repository is shared among multiple parties • Increases your

    risk for a security exploitation Why is this a bad practice?
  3. • application is open source • application requires a high

    level of governance e.g. financial, healthcare • application involves transient contractors
 e.g. agency • application located on multiple services
 e.g. CodeClimate When is this a bad practice?
  4. • Rails 4.1 application • Deploy to Heroku
 Platform as

    a Service (PaaS) • Configure Stripe with an API key
 Payment Gateway Demo
  5. Review 1 # config/secrets.yml" 2 " 3 production:" 4 secret_key_base:

    <%= ENV[‘SECRET_KEY_BASE’] %>" 5 stripe_api_key: <%= ENV[‘STRIPE_API_KEY’] %> 1 2 3 heroku config:add STRIPE_API_KEY=montreal.rb-prod 1 # config/initializers/stripe.rb" 2 " 3 Stripe.api_key = " 4 Rails.application.secrets.stripe_api_key
  6. • Don’t commit your secrets • If you have committed

    your secrets: • setup your application to use environment variables or a configuration file • reset your API keys and other secrets Remember