Skip to content

security: move JWT secret to environment variable#704

Merged
lane711 merged 1 commit intomainfrom
merge-pr-660-jwt-secret-env
Mar 27, 2026
Merged

security: move JWT secret to environment variable#704
lane711 merged 1 commit intomainfrom
merge-pr-660-jwt-secret-env

Conversation

@lane711
Copy link
Copy Markdown
Collaborator

@lane711 lane711 commented Mar 27, 2026

Summary

Cherry-picked from #660 by @mmcintosh

Moves hardcoded JWT secret to an environment variable for proper secret management.


Attribution

Closes #660

🤖 Generated with Claude Code

- Add optional secret parameter to generateToken/verifyToken
- Falls back to hardcoded constant for local dev without wrangler secret
- Add JWT_SECRET to Bindings interface
- Update all generateToken callsites to pass c.env.JWT_SECRET
- Update requireAuth and optionalAuth middleware to pass env secret
- Update magic-link-auth and otp-login plugins

Production: set via `wrangler secret put JWT_SECRET`

Fixes VULN-001
@lane711 lane711 merged commit 0fcea88 into main Mar 27, 2026
2 checks passed
lane711 added a commit that referenced this pull request Mar 30, 2026
Security hardening release:
- SQL injection fix via sort order validation (#713)
- Reflected XSS fix on auth pages (#714)
- Stored XSS fix in content preview (#715)
- Security headers middleware (#708)
- Auth endpoint rate limiting (#707)
- CORS restrictions (#706)
- PBKDF2 password hashing (#705)
- JWT secret to environment variable (#704)

Bug fixes:
- Radio field support (#723)
- Confirm dialogs for repeater/block deletes (#722)
- Rich text editor field types (#721)
- user_profiles migration in core (#718)
- itemTitle for structured arrays (#725)

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

2 participants