fix: remove unused http import and set stable secret key fallback#503
fix: remove unused http import and set stable secret key fallback#503asiyasafwana15-byte wants to merge 1 commit into
Conversation
|
@asiyasafwana15-byte is attempting to deploy a commit to the 007's projects Team on Vercel. A member of the Team first needs to authorize it. |
Thanks for creating a PR for your Issue!
|
|
|
||
| # Define upload folder path for certificates | ||
| UPLOAD_FOLDER = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static", "uploads") | ||
| UPLOAD_FOLDER = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static" "uploads") |
There was a problem hiding this comment.
Missing comma in os.path.join concatenates 'static' and 'uploads' into 'staticuploads'
Python's implicit string literal concatenation turns "static" "uploads" into a single argument "staticuploads", so UPLOAD_FOLDER resolves to <base>/staticuploads (a non-existent path) instead of <base>/static/uploads. File saves at line 473 and profile-directory creation at line 663 will write to the wrong location.
| UPLOAD_FOLDER = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static" "uploads") | |
| UPLOAD_FOLDER = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static", "uploads") |
Prompt to fix with AI
Copy this prompt into your AI coding assistant to fix this issue.
In app.py at line 41, the call to os.path.join is missing a comma between "static" and "uploads". Python's implicit string concatenation silently merges them into "staticuploads", making UPLOAD_FOLDER point to a wrong path. Fix by changing the line to:
UPLOAD_FOLDER = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static", "uploads")
|
|
||
| app = Flask(__name__) | ||
| app.secret_key = os.environ.get("SECRET_KEY", secrets.token_hex(16)) | ||
| app.secret_key = os.environ.get("SECRET_KEY" ,"dev-secret-key-change-me") |
There was a problem hiding this comment.
Hardcoded default secret key exposes session signing to anyone who reads the repo
Any deployment that omits the SECRET_KEY env var will use the publicly visible string "dev-secret-key-change-me", allowing an attacker to forge signed session cookies. The previous default secrets.token_hex(16) was randomly generated per process, which was safer.
Prompt to fix with AI
Copy this prompt into your AI coding assistant to fix this issue.
In app.py at line 21, the Flask secret key fallback was changed from `secrets.token_hex(16)` to the hardcoded string `"dev-secret-key-change-me"`. This is a security vulnerability: any deployment without the SECRET_KEY env var will use a publicly known key, enabling session cookie forgery. Revert the fallback to `secrets.token_hex(16)` (which requires the `secrets` module already imported) or raise a `RuntimeError` when SECRET_KEY is missing in production.
Confidence Score: 1/5 - Blocking IssuesNot safe to merge — this PR introduces two serious regressions in Key Findings:
Files requiring special attention
|




Which issue does this PR close?
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?