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
420
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
27
The Elephant and the Serpent (PyLatam 2019)
phildini
0
68
Account Security for the Fashionable App Developer
phildini
1
68
All in the Timing: Side-Channel Attacks
phildini
0
67
Giving Thanks
phildini
0
45
All in the Timing: Side-Channel Attacks in Python
phildini
0
420
API-Driven Django
phildini
1
410
Type uWSGI; Press Enter; What Happens?
phildini
0
99
Type uWSGI; Press Enter; What Happens?
phildini
1
80
Other Decks in Technology
See All in Technology
Amazon ECS デプロイツール ecspresso の開発を支える「正しい抽象化」の探求 / YAPC::Fukuoka 2025
fujiwara3
13
3.7k
Black Hat USA 2025 Recap ~ クラウドセキュリティ編 ~
kyohmizu
0
550
Devoxx Morocco 2025 - Like Spring but faster: The new Java Jedi
edeandrea
PRO
0
100
ステートレスなLLMでステートフルなAI agentを作る - YAPC::Fukuoka 2025
gfx
8
1.3k
重厚長大企業で、顧客価値をスケールさせるためのプロダクトづくりとプロダクト開発チームづくりの裏側 / Developers X Summit 2025
mongolyy
0
140
グローバルなコンパウンド戦略を支えるモジュラーモノリスとドメイン駆動設計
kawauso
1
390
AI時代の戦略的アーキテクチャ 〜Adaptable AI をアーキテクチャで実現する〜 / Enabling Adaptable AI Through Strategic Architecture
bitkey
PRO
4
130
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
4
1.3k
技術広報のOKRで生み出す 開発組織への価値 〜 カンファレンス協賛を通して育む学びの文化 〜 / Creating Value for Development Organisations Through Technical Communications OKRs — Nurturing a Culture of Learning Through Conference Sponsorship —
pauli
5
380
Javaコミュニティの歩き方 ~参加から貢献まで、すべて教えます~
tabatad
0
130
Capitole du Libre 2025 - Keynote - Cloud du Coeur
ju_hnny5
0
110
Introducing RFC9111 / YAPC::Fukuoka 2025
k1low
1
270
Featured
See All Featured
Balancing Empowerment & Direction
lara
5
750
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.2k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Become a Pro
speakerdeck
PRO
29
5.6k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Site-Speed That Sticks
csswizardry
13
960
Building Applications with DynamoDB
mza
96
6.8k
Faster Mobile Websites
deanohume
310
31k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
24
1.6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.7k
RailsConf 2023
tenderlove
30
1.3k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
970
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”!