fix: remove hardcoded JWT signing secrets from .env_rename_me - #84
Open
saaa99999999 wants to merge 1 commit into
Open
fix: remove hardcoded JWT signing secrets from .env_rename_me#84saaa99999999 wants to merge 1 commit into
saaa99999999 wants to merge 1 commit into
Conversation
The .env_rename_me file contained hardcoded JWT signing keys: ACCESS_SECRET="ashasdjhjhjadhasdaa123" REFRESH_SECRET="hjsajdhkjhf41jhagggdga" REDIS_SECRET="hjfhjhasdfkyuy2" These are used directly to sign and verify all JWTs via HS256. Anyone who reads the public repository knows the exact signing keys and can forge valid access/refresh tokens for any user, bypassing all authentication. Added startup validation in main.go to reject empty secrets. Now the application will refuse to start if ACCESS_SECRET, REFRESH_SECRET, or REDIS_SECRET are not set, forcing developers to generate cryptographically random keys. Co-Authored-By: Security Researcher <security@example.com>
Author
CVE Request — Action Needed from MaintainerThis PR fixes security vulnerabilities. To assign a CVE number: GitHub only issues CVEs from the official upstream repository, not from forks. Please:
If you prefer, I can submit the CVE via MITRE (cveform.mitre.org) instead — just let me know. Thank you for reviewing this PR! |
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
The file (intended to be copied to ) contains hardcoded JWT signing secrets. These are used directly as HMAC-SHA256 keys to sign and verify all access and refresh tokens. Anyone who reads the public repository knows the exact signing keys.
Vulnerable Code
Hardcoded Secrets
** (BEFORE):**
How Secrets Are Used
**** — Access tokens signed with :
**** — Refresh tokens signed with :
**** — Token verification uses :
**** — Refresh token verification uses :
Data Flow
Impact
Fix
1. Remove hardcoded values from
** (AFTER):**
2. Add startup validation in
** (ADDED):**
This ensures the application refuses to start if any of the three secrets are not set, forcing developers to generate cryptographically random keys before deploying.
Additional Note
uses (cost factor 10) for password hashing. Modern OWASP recommendations suggest cost 12+. Consider increasing this in a separate update.