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
430
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Oops I Committed My Secret Key
Lightning talk given at DjangoCon US 2016
Philip James
July 20, 2016
More Decks by Philip James
See All by Philip James
Frog and Toad Learn about Django Security - NBT6
phildini
0
36
The Elephant and the Serpent (PyLatam 2019)
phildini
0
76
Account Security for the Fashionable App Developer
phildini
1
76
All in the Timing: Side-Channel Attacks
phildini
0
84
Giving Thanks
phildini
0
50
All in the Timing: Side-Channel Attacks in Python
phildini
0
430
API-Driven Django
phildini
1
450
Type uWSGI; Press Enter; What Happens?
phildini
0
120
Type uWSGI; Press Enter; What Happens?
phildini
1
98
Other Decks in Technology
See All in Technology
Genie Codeハンズオン基礎編
taka_aki
1
100
『三匹の子ぶた』から学ぶネットワークセキュリティの昔と今 / Network Security: Then and Now Through the Lens of The Three Little Pigs
nttcom
1
1.8k
サイバー捜査員研修(前半)
nomizone
1
2k
AIコーディングの次。コードレビューと理解負荷を解消して組織の開発生産性を高める
moongift
PRO
2
2.4k
AWS ネットワーク構築でハマった(ハマりかけた) 5選とそこから得た教訓
nagisa53
4
200
Webアクセシビリティ入門 2026
recruitengineers
PRO
3
520
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.2k
老害フォレンジッカーはAI羊の夢を見るか?
tadmaddad
0
310
事業価値と Engineering 2026年度版
recruitengineers
PRO
47
23k
【CEDEC2026】ゲームシナリオライターを支援するAIツール開発の実践 ― 設計とプロンプトの工夫 ―
cygames
PRO
1
790
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
24k
モバイルアプリ開発概論2026
recruitengineers
PRO
5
550
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
9
950
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
410
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
290
The untapped power of vector embeddings
frankvandijk
2
1.8k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
360
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
380
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
430
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.1k
Technical Leadership for Architectural Decision Making
baasie
3
470
KATA
mclloyd
PRO
35
15k
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”!