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
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
28
The Elephant and the Serpent (PyLatam 2019)
phildini
0
70
Account Security for the Fashionable App Developer
phildini
1
73
All in the Timing: Side-Channel Attacks
phildini
0
70
Giving Thanks
phildini
0
48
All in the Timing: Side-Channel Attacks in Python
phildini
0
420
API-Driven Django
phildini
1
430
Type uWSGI; Press Enter; What Happens?
phildini
0
110
Type uWSGI; Press Enter; What Happens?
phildini
1
86
Other Decks in Technology
See All in Technology
ASTのGitHub CopilotとCopilot CLIの現在地をお話しします/How AST Operates GitHub Copilot and Copilot CLI
aeonpeople
1
220
AI時代に新卒採用、はじめました/junior-engineer-never-die
dmnlk
0
240
Strands Agents × Amazon Bedrock AgentCoreで パーソナルAIエージェントを作ろう
yokomachi
2
270
Introduction to Bill One Development Engineer
sansan33
PRO
0
400
NgRx SignalStore: The Power of Extensibility
rainerhahnekamp
0
210
え!?初参加で 300冊以上 も頒布!? これは大成功!そのはずなのに わいの財布は 赤字 の件
hellohazime
0
120
Data Hubグループ 紹介資料
sansan33
PRO
0
2.9k
60分で学ぶ最新Webフロントエンド
mizdra
PRO
18
8.8k
Bluesky Meetup in Tokyo vol.4 - 2023to2026
shinoharata
0
150
終盤で崩壊させないAI駆動開発
j5ik2o
0
500
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
4
23k
DevOpsDays2026 Tokyo Cross-border practices to connect "safety" and "DX" in healthcare
hokkai7go
0
130
Featured
See All Featured
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1k
Design in an AI World
tapps
0
190
Statistics for Hackers
jakevdp
799
230k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.5k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
220
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
270
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
43k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
260
Un-Boring Meetings
codingconduct
0
260
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
160
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”!