Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import secrets
import connexion
from flask import jsonify
from flask_sqlalchemy import SQLAlchemy
Expand All @@ -10,7 +11,12 @@
vuln_app.app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI
vuln_app.app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

vuln_app.app.config['SECRET_KEY'] = 'random'
# JWT signing key must never be a fixed literal shipped in source: a hardcoded key lets
# anyone forge auth tokens offline for any user (including admin) without ever logging in.
# Prefer an operator-supplied secret (e.g. injected via environment/secret manager); fall
# back to a securely-generated random key per process so there is no shared, guessable
# default even when no override is configured.
vuln_app.app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY') or secrets.token_hex(32)
# start the db
db = SQLAlchemy(vuln_app.app)

Expand Down
Loading