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
400
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
25
The Elephant and the Serpent (PyLatam 2019)
phildini
0
54
Account Security for the Fashionable App Developer
phildini
1
64
All in the Timing: Side-Channel Attacks
phildini
0
56
Giving Thanks
phildini
0
42
All in the Timing: Side-Channel Attacks in Python
phildini
0
410
API-Driven Django
phildini
1
370
Type uWSGI; Press Enter; What Happens?
phildini
0
95
Type uWSGI; Press Enter; What Happens?
phildini
1
74
Other Decks in Technology
See All in Technology
アーキテクチャわからん、の話
shirayanagiryuji
0
150
“自分”を大切に、フラットに。キャリアチェンジしてからの一年 三ヶ月で見えたもの。
maimyyym
0
300
Platform EngineeringがあればSREはいらない!? 新時代のSREに求められる役割とは
mshibuya
2
4k
Women in Agile
kawaguti
PRO
2
170
20250125_Agent for Amazon Bedrock試してみた
riz3f7
2
110
Zenn のウラガワ ~エンジニアのアウトプットを支える環境で Google Cloud が採用されているワケ~ #burikaigi #burikaigi_h
kongmingstrap
18
6.9k
バクラクの組織とアーキテクチャ(要約)2025/01版
shkomine
13
3k
業務ツールをAIエージェントとつなぐ - Composio
knishioka
0
120
さいきょうのアーキテクチャを生み出すセンスメイキング
jgeem
0
270
RevOpsへ至る道 データ活用による事業革新への挑戦 / path-to-revops
pei0804
3
810
ハンズオンで学ぶ Databricks - Databricksにおけるデータエンジニアリング
taka_aki
1
2.1k
Amazon Aurora バージョンアップについて、改めて理解する ~バージョンアップ手法と文字コードへの影響~
smt7174
1
250
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
96
5.3k
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
The World Runs on Bad Software
bkeepers
PRO
67
11k
Designing Experiences People Love
moore
139
23k
We Have a Design System, Now What?
morganepeng
51
7.4k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
11
900
Being A Developer After 40
akosma
89
590k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.5k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.3k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
52k
Testing 201, or: Great Expectations
jmmastey
41
7.2k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.4k
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”!