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.3k
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
Preventing Brain Freeze: Onboarding New Developers with Living Documentation
nicholasjhenry
0
73
The Upside Down Dimension of Elixir - An introduction to metaprogramming
nicholasjhenry
1
160
Building the Montreal Elixir Community
nicholasjhenry
0
50
How Elixir is Transforming My Mind
nicholasjhenry
1
5.4k
Modeling on the Right Side of the Brain
nicholasjhenry
1
8.4k
Other Decks in Programming
See All in Programming
DefinitelyTypedに初めてPRを出した話
syumai
0
140
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
160
カラム追加で増えるActiveRecordのメモリサイズ イメージできますか?
asayamakk
4
2k
受け取る人から提供する人になるということ
little_rubyist
0
210
役立つログに取り組もう
irof
28
9.4k
C++でシェーダを書く
fadis
6
4k
CSC509 Lecture 11
javiergs
PRO
0
180
Importmapを使ったJavaScriptの 読み込みとブラウザアドオンの影響
swamp09
4
1.3k
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
470
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
280
From Subtype Polymorphism To Typeclass-based Ad hoc Polymorphism- An Example
philipschwarz
PRO
0
200
Dev ContainersとGitHub Codespacesの素敵な関係
ymd65536
1
140
Featured
See All Featured
Gamification - CAS2011
davidbonilla
80
5k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Documentation Writing (for coders)
carmenintech
65
4.4k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Rails Girls Zürich Keynote
gr2m
93
13k
Navigating Team Friction
lara
183
14k
Happy Clients
brianwarren
97
6.7k
YesSQL, Process and Tooling at Scale
rocio
168
14k
Designing the Hi-DPI Web
ddemaree
280
34k
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