Skip to content
Open
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
11 changes: 9 additions & 2 deletions app/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@

load_dotenv()

import os

class Config:
SECRET_KEY = os.getenv("SECRET_KEY", "default-secret-key")
DEBUG = os.getenv("DEBUG", False)
# FIX: Do not use a hardcoded default for SECRET_KEY. Raise an error if not set.
SECRET_KEY = os.getenv("SECRET_KEY")
if not SECRET_KEY:
raise RuntimeError("SECRET_KEY environment variable must be set and not empty!")
DEBUG = os.getenv("DEBUG", "False").lower() in ("true", "1", "yes")
CORS_ORIGINS = os.getenv("CORS_ORIGINS", "*")

# FIX EXPLANATION: The fix removes the insecure hardcoded default for SECRET_KEY and enforces that it must be set in the environment. This prevents accidental use of a known, weak key in any environment, ensuring cryptographic operations remain secure. Additionally, DEBUG is now parsed as a boolean for correctness.