[Security] Fix 5 vulnerabilities: Hardcoded JWT Secret, DB Credentials, Mass Assignment, IDOR, Password in URL (CWE-798, CWE-915, CWE-639, CWE-598)#68
Open
saaa99999999 wants to merge 1 commit into
Conversation
… CWE-598) - Remove hardcoded JWT secret ($eCrEt) from all 3 environments - Remove hardcoded MySQL credentials (root/root) from all configs - Add mass assignment protection with field whitelist in user update - Add ownership verification to user get/update/delete (IDOR fix) - Switch password from req.query to req.body (prevent URL logging) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Security Audit Report — node-jwt
Manual code audit discovered 5 security vulnerabilities (3 Critical, 2 High).
CRITICAL-1: CWE-798 Hardcoded JWT Secret (CVSS 9.8)
Location: config/env/development.js:10, config/env/production.js:10, config/env/test.js:10
Data Flow:
config/env/production.js:10 jwtSecret: '$eCrEt'
-> config/env/index.js:2 -> config/routes/user.js:8 -> express-jwt verification
Impact: The JWT secret '$eCrEt' is hardcoded identically in ALL environments. Anyone with repository access can forge valid JWTs for any user.
PoC:
CRITICAL-2: CWE-798 Hardcoded DB Root Credentials (CVSS 9.8)
Location: config/env/production.js:5-7
MySQL root/root credentials hardcoded in production config.
CRITICAL-3: CWE-915 Mass Assignment (CVSS 9.1)
Location: api/controllers/UserController.js:32
req.dbUser.update(req.body) with NO field whitelist. Attackers can overwrite password, refresh_token, or any user field.
PoC:
HIGH-4: CWE-639 IDOR — No Ownership Check (CVSS 8.1)
GET/PUT/DELETE /users/:userId requires only a valid JWT but never checks if the requesting user owns the target account.
HIGH-5: CWE-598 Passwords in URL Query String (CVSS 7.5)
Passwords read from req.query (URL query string) instead of req.body, exposing them in server/proxy/CDN logs.
CVE Request
Advisory: GHSA-cxfg-wv83-vgqg
CVE ID pending — GitHub CNA review (1-5 business days).