-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.py
30 lines (24 loc) · 931 Bytes
/
index.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
import hashlib
import binascii
def process_request(request):
password = request.GET["password"]
# BAD: Inbound authentication made by comparison to string literal
if password == "myPa55word":
redirect("login")
hashed_password = load_from_config('hashed_password', CONFIG_FILE)
salt = load_from_config('salt', CONFIG_FILE)
#GOOD: Inbound authentication made by comparing to a hash password from a config file.
dk = hashlib.pbkdf2_hmac('sha256', password, salt, 100000)
hashed_input = binascii.hexlify(dk)
if hashed_input == hashed_password:
redirect("login")
def AWS():
if os.getenv("JOB_IS_RUNNING_ON_CI"):
S3_CLIENT = boto3.client("s3")
else:
S3_CLIENT = boto3.client(
"s3",
aws_access_key_id=" AKIAIOSFODNN7EXAMPLE",
aws_secret_access_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
)