Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Don't Commit Your Secrets
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Nicholas Henry
June 17, 2014
Programming
0
7k
Don't Commit Your Secrets
How to keep your application secrets safe
Nicholas Henry
June 17, 2014
Tweet
Share
More Decks by Nicholas Henry
See All by Nicholas Henry
Mise en Place for Ecto
nicholasjhenry
0
10
Beyond Mocks - Messing with Our Preconceptions of Testing
nicholasjhenry
0
16
Preventing Brain Freeze: Onboarding New Developers with Living Documentation
nicholasjhenry
0
110
The Upside Down Dimension of Elixir - ElixirConf
nicholasjhenry
0
8
The Upside Down Dimension of Elixir - An introduction to metaprogramming
nicholasjhenry
1
220
Building the Montreal Elixir Community
nicholasjhenry
0
54
How Elixir is Transforming My Mind
nicholasjhenry
1
6.2k
Modeling on the Right Side of the Brain
nicholasjhenry
1
9.3k
Other Decks in Programming
See All in Programming
AtCoder Conference 2025
shindannin
0
1k
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
1k
組織で育むオブザーバビリティ
ryota_hnk
0
170
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.5k
Fragmented Architectures
denyspoltorak
0
150
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
CSC307 Lecture 02
javiergs
PRO
1
770
余白を設計しフロントエンド開発を 加速させる
tsukuha
7
2.1k
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
170
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
160
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
Fluid Templating in TYPO3 14
s2b
0
130
Featured
See All Featured
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.5k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
120
GraphQLの誤解/rethinking-graphql
sonatard
74
11k
The Curious Case for Waylosing
cassininazir
0
230
Into the Great Unknown - MozCon
thekraken
40
2.3k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
sira's awesome portfolio website redesign presentation
elsirapls
0
150
Building Adaptive Systems
keathley
44
2.9k
Become a Pro
speakerdeck
PRO
31
5.8k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
130
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
0
110
Transcript
Don’t Commit Your Secrets How to keep your application
secrets safe ! Nicholas Henry
Your secrets are everywhere • Passwords • Credentials • API
Keys • Database • Amazon S3 • Stripe • Mail Chimp Examples Synonyms
None
• Repository is shared among multiple parties • Increases your
risk for a security exploitation Why is this a bad practice?
• 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?
When is this a bad practice? ALWAYS!
• Environment Variables • Configuration files Your options
Environment Variables # setting environment variable export STRIPE_API_KEY=07bfb7a5487dc6df" # retrieving
from Ruby ENV[‘STRIPE_API_KEY’] # =>07bfb7a5487dc6df
1 # config/application.yml" 2 " 3 production:" 4 secret_key_base: 33619eed953400c0e58695"
5 stripe_api_key: 07bfb7a5487dc6df Configuration File
• Rails 4.1 application • Deploy to Heroku Platform as
a Service (PaaS) • Configure Stripe with an API key Payment Gateway Demo
• configuration file / environments variables • config/secrets.yml" • Rails.application.secrets.your_api_key
Rails helps us keep secrets safe
None
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
• 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
nicholas@firsthand.ca @nicholasjhenry Nicholas Henry http://blog.firsthand.ca