Skip to content

fix: remove hardcoded secrets from embedded config and add JWT algorithm verification#727

Open
saaa99999999 wants to merge 1 commit into
rocboss:mainfrom
saaa99999999:main
Open

fix: remove hardcoded secrets from embedded config and add JWT algorithm verification#727
saaa99999999 wants to merge 1 commit into
rocboss:mainfrom
saaa99999999:main

Conversation

@saaa99999999

Copy link
Copy Markdown

Summary

The embedded config.yaml shipped in every binary contains hardcoded production credentials that are identical across all deployments:

  • JWT Secret — allows forging tokens for any user
  • MySQL/Postgres passwords — database access
  • MinIO access/secret keys — object storage access
  • Zinc, MeiliSearch, OpenObserve passwords and API keys — search/log infrastructure access
  • Alipay RSA private key — payment signing key

Additionally, ParseToken() does not verify the JWT signing algorithm.

Changes

  • internal/conf/config.yaml: Replaced all hardcoded secrets with empty strings
  • internal/conf/conf.go: Added startup validation that exits with error if JWT Secret is not configured
  • pkg/app/jwt.go: Added HMAC algorithm verification in ParseToken() callback

Test plan

  • Config loads without JWT secret → exits with fatal error
  • JWT tokens work with properly configured secret
  • Tokens signed with non-HMAC algorithms are rejected

🤖 Generated with Claude Code

…thm verification

Replace hardcoded JWT secret, DB passwords, OSS credentials, and API
keys in embedded config.yaml with empty strings. Add JWT secret validation
at startup. Add HMAC algorithm verification in ParseToken to prevent
JWT algorithm confusion attacks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant