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
58
Account Security for the Fashionable App Developer
phildini
1
65
All in the Timing: Side-Channel Attacks
phildini
0
57
Giving Thanks
phildini
0
42
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
OPENLOGI Company Profile
hr01
0
60k
生成AI×財務経理:PoCで挑むSlack AI Bot開発と現場巻き込みのリアル
pohdccoe
1
840
あなたが人生で成功するための5つの普遍的法則 #jawsug #jawsdays2025 / 20250301 HEROZ
yoshidashingo
2
430
書籍『入門 OpenTelemetry』 / Intro of OpenTelemetry book
ymotongpoo
4
280
QAエンジニアが スクラムマスターをすると いいなぁと思った話
____rina____
0
200
アジャイルな開発チームでテスト戦略の話は誰がする? / Who Talks About Test Strategy?
ak1210
1
870
事業モメンタムを生み出すプロダクト開発
macchiitaka
0
110
AWSアカウントのセキュリティ自動化、どこまで進める? 最適な設計と実践ポイント
yuobayashi
7
2k
事業を差別化する技術を生み出す技術
pyama86
2
560
データベースの負荷を紐解く/untangle-the-database-load
emiki
2
560
貧民的プログラミングのすすめ
kakehashi
PRO
2
220
生成AIがローコードツールになる時代の エンジニアの役割を考える
khwada
0
260
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Site-Speed That Sticks
csswizardry
4
420
Product Roadmaps are Hard
iamctodd
PRO
51
11k
Code Review Best Practice
trishagee
67
18k
GraphQLとの向き合い方2022年版
quramy
44
14k
It's Worth the Effort
3n
184
28k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.5k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.3k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3k
Optimizing for Happiness
mojombo
377
70k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
Git: the NoSQL Database
bkeepers
PRO
429
65k
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”!