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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Nicholas Henry
June 17, 2014
Programming
7.3k
0
Share
Don't Commit Your Secrets
How to keep your application secrets safe
Nicholas Henry
June 17, 2014
More Decks by Nicholas Henry
See All by Nicholas Henry
Mise en Place for Ecto
nicholasjhenry
0
29
Beyond Mocks - Messing with Our Preconceptions of Testing
nicholasjhenry
0
29
Preventing Brain Freeze: Onboarding New Developers with Living Documentation
nicholasjhenry
0
120
The Upside Down Dimension of Elixir - ElixirConf
nicholasjhenry
0
18
The Upside Down Dimension of Elixir - An introduction to metaprogramming
nicholasjhenry
1
230
Building the Montreal Elixir Community
nicholasjhenry
0
58
How Elixir is Transforming My Mind
nicholasjhenry
1
6.4k
Modeling on the Right Side of the Brain
nicholasjhenry
1
9.5k
Other Decks in Programming
See All in Programming
SkillsをS3 Filesに置く時のあれこれ
watany
3
1.7k
Are We Really Coding 10× Faster with AI?
kohzas
0
210
開発とはなにか、Essenceカーネルで見えるもの
ukin0k0
0
200
継続的な負荷検証を目指して
pyama86
3
1.4k
1人1案件のプロダクトエンジニア時代に、"プロセス監督"としてチャレンジしたこと
non0113
0
160
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
470
Import assertionsが消えた日~ECMAScriptの仕様はどう決まり、なぜ覆るのか~
bicstone
2
190
色即是空、空即是色、データサイエンス
kamoneggi
1
140
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
0
130
書き換えて学ぶTemporal #fukts
pirosikick
2
390
Swiftのレキシカルスコープ管理
kntkymt
0
170
PHPでローカル環境用のSSL/TLS証明書を発行することはできるのか? #phpconkagawa
akase244
0
380
Featured
See All Featured
The browser strikes back
jonoalderson
0
1.1k
The Curse of the Amulet
leimatthew05
1
12k
Between Models and Reality
mayunak
4
290
Information Architects: The Missing Link in Design Systems
soysaucechin
0
930
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
380
WENDY [Excerpt]
tessaabrams
10
37k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.3k
Accessibility Awareness
sabderemane
1
120
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
55k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
140
Prompt Engineering for Job Search
mfonobong
0
310
Discover your Explorer Soul
emna__ayadi
2
1.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