Remove hardcoded default JWT secret key and database password#37
Open
saaa99999999 wants to merge 1 commit into
Open
Remove hardcoded default JWT secret key and database password#37saaa99999999 wants to merge 1 commit into
saaa99999999 wants to merge 1 commit into
Conversation
The JWT signing key was hardcoded in config/env.py, allowing anyone with access to the repository source code to forge valid JWT tokens for any user and gain administrative access. The database password was also hardcoded as a default value. Both defaults have been replaced with empty strings; the values must now be set via environment variables (JWT_SECRET_KEY, DB_PASSWORD) or .env files.
Author
CVE RequestThis PR fixes CWE-798 (Use of Hard-coded Credentials): the JWT signing key was hardcoded in Could you please request a CVE via GitHub Security Advisory for this vulnerability? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ruoyi-fastapi-backend/config/env.pycontained a hardcoded default JWT signing key and a hardcoded default database password, allowing anyone with access to the repository source code to:Changes
jwt_secret_keydefault value (was'b01c66dc2c58dc6a0aabfe2144256be36226de378bf87f72c0c795dda67f4d55')db_passworddefault value (was'mysqlroot')JWT_SECRET_KEY,DB_PASSWORD) or.envfilesFixed Vulnerability
Test plan
JWT_SECRET_KEYenv var or.envvalue, verify JWT auth worksDB_PASSWORDenv var or.envvalue, verify database connection works