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
Nicholas Henry
June 17, 2014
Programming
0
6.8k
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
6
Beyond Mocks - Messing with Our Preconceptions of Testing
nicholasjhenry
0
14
Preventing Brain Freeze: Onboarding New Developers with Living Documentation
nicholasjhenry
0
110
The Upside Down Dimension of Elixir - ElixirConf
nicholasjhenry
0
3
The Upside Down Dimension of Elixir - An introduction to metaprogramming
nicholasjhenry
1
210
Building the Montreal Elixir Community
nicholasjhenry
0
53
How Elixir is Transforming My Mind
nicholasjhenry
1
6k
Modeling on the Right Side of the Brain
nicholasjhenry
1
9k
Other Decks in Programming
See All in Programming
One Enishi After Another
snoozer05
PRO
0
170
When Dependencies Fail: Building Antifragile Applications in a Fragile World
selcukusta
0
120
ドメイン駆動設計のエッセンス
masuda220
PRO
15
7.1k
CSC305 Lecture 13
javiergs
PRO
0
330
モテるデスク環境
mozumasu
3
1.4k
Claude Agent SDK を使ってみよう
hyshu
0
1.5k
Developer Joy - The New Paradigm
hollycummins
1
400
マイベストのシンプルなデータ基盤の話 - Googleスイートとのつき合い方 / mybest-simple-data-architecture-google-nized
snhryt
0
110
Amazon ECS Managed Instances が リリースされた!キャッチアップしよう!! / Let's catch up Amazon ECS Managed Instances
cocoeyes02
0
120
Kotlin 2.2が切り拓く: コンテキストパラメータで書く関数型DSLと新しい依存管理のかたち
knih
0
110
iOSでSVG画像を扱う
kishikawakatsumi
0
180
contribution to astral-sh/uv
shunsock
0
570
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.7k
Git: the NoSQL Database
bkeepers
PRO
431
66k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
GraphQLとの向き合い方2022年版
quramy
49
14k
Typedesign – Prime Four
hannesfritz
42
2.8k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
191
56k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1k
Why Our Code Smells
bkeepers
PRO
340
57k
Automating Front-end Workflow
addyosmani
1371
200k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.1k
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