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
Oops I Committed My Secret Key
Search
Philip James
July 20, 2016
Technology
0
410
Oops I Committed My Secret Key
Lightning talk given at DjangoCon US 2016
Philip James
July 20, 2016
Tweet
Share
More Decks by Philip James
See All by Philip James
Frog and Toad Learn about Django Security - NBT6
phildini
0
26
The Elephant and the Serpent (PyLatam 2019)
phildini
0
60
Account Security for the Fashionable App Developer
phildini
1
65
All in the Timing: Side-Channel Attacks
phildini
0
57
Giving Thanks
phildini
0
43
All in the Timing: Side-Channel Attacks in Python
phildini
0
410
API-Driven Django
phildini
1
380
Type uWSGI; Press Enter; What Happens?
phildini
0
95
Type uWSGI; Press Enter; What Happens?
phildini
1
75
Other Decks in Technology
See All in Technology
Microsoft_20250311_AzureIoTPortfolio_PDF.pdf
iotcomjpadmin
0
240
ソフトウェア開発におけるインターフェイスという考え方 / PHPerKaigi 2025
k1low
3
440
ドメインイベントを活用したPHPコードのリファクタリング
kajitack
0
570
AI の活用における課題と現状、今後の期待
asei
2
120
VPoEの引き継ぎでやったこと、わかったこと
saitoryc
2
1.1k
AWS のポリシー言語 Cedar を活用した高速かつスケーラブルな認可技術の探求 #phperkaigi / PHPerKaigi 2025
ytaka23
6
740
単一の深層学習モデルによる不確実性の定量化の紹介 ~その予測結果正しいですか?~
ftakahashi
PRO
3
430
Scala meets WebAssembly
tanishiking
0
160
Agent Mode とは?GitHub Copilot の新機能を探る
lescoggi
1
150
テクスチャ画像付きのメッシュモデルを3次元点群へ変換する
kentaitakura
1
420
保育 AI「たよれるくん」で 保育の質向上をアシスト
skakimoto
0
140
eBPF-based Process Lifecycle Monitoring
yukinakanaka
1
150
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
244
12k
The Pragmatic Product Professional
lauravandoore
32
6.5k
How to Think Like a Performance Engineer
csswizardry
22
1.4k
Java REST API Framework Comparison - PWX 2021
mraible
29
8.4k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
The Invisible Side of Design
smashingmag
299
50k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
11
1.4k
A Philosophy of Restraint
colly
203
16k
Agile that works and the tools we love
rasmusluckow
328
21k
Thoughts on Productivity
jonyablonski
69
4.5k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
28
2k
For a Future-Friendly Web
brad_frost
176
9.6k
Transcript
Oops I Commi*ed My Secret Key Philip James @phildini h*ps:/
/www.wordfugue.com
$ django-admin.py startproject bestthingever $ git init $ git add
. $ git commit -m "Initial commit” $ git push origin master
None
Wait, have I?
YES. Signed Cookies Secure Sessions Password Reset Tokens
What do I do?
import os import warnings from django.core.exceptions import ImproperlyConfigured def get_env_variable(var_name):
""" Get the environment variable or return exception """ try: return os.environ[var_name] except KeyError: error_msg = "Set the %s env variable" % var_name if DEBUG: warnings.warn(error_msg) else: raise ImproperlyConfigured(error_msg)
SECRET_KEY = get_env_variable("SECRET_KEY")
How do I get a new key?
h*p:/ /www.miniwebtool.com/django-secret-key-generator/ $ python manage.py shell >>> from django.utils.crypto import
get_random_string >>> get_random_string(length=50)
What about my users?
OpOonal: No permanent key
Thanks. @phildini h*p:/ /bit.ly/secret-key Come back at 1:15PM for “Cat
on yer head”!