Skip to content

Conversation

@skrylnikov
Copy link
Owner

🔒 Security Fixes

  • Fixed security issue: Replaced insecure cookie-based session storage with JWT tokens
  • Session data is now stored as signed JWT tokens using the jose library with HS512 algorithm
  • Improved session validation and security

⚠️ Breaking Changes

  • JWT_SECRET environment variable required: When OIDC authentication is enabled, you must now configure the JWT_SECRET environment variable
  • The JWT_SECRET is used to sign and verify JWT tokens for user sessions
  • OIDC authentication will not work without JWT_SECRET configured
  • See README for instructions on generating a secure JWT secret

📝 Documentation

  • Added JWT_SECRET to environment variables documentation
  • Added instructions for generating JWT secrets using OpenSSL, Node.js/Bun, and Python
  • Updated troubleshooting section with JWT-related information

🔧 Technical Changes

  • Upgraded jose library to version 6.1.2
  • Replaced JSON cookie storage with JWT token-based authentication
  • Updated getAuthSession() to validate JWT tokens
  • Added createJWT() function for token generation

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces insecure cookie-based session storage with JWT tokens to improve security. Session data is now stored as signed JWT tokens using the jose library with the HS512 algorithm, requiring a new JWT_SECRET environment variable when OIDC authentication is enabled.

Key Changes

  • Implemented JWT-based authentication using the jose library (v6.1.2) with HS512 signing algorithm
  • Added createJWT() function to generate signed tokens and updated getAuthSession() to validate them
  • Made JWT_SECRET a required environment variable when OIDC is enabled

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/lib/auth.ts Added JWT token creation and verification logic, updated session validation to use JWT tokens instead of plain JSON
src/routes/api/auth/callback.tsx Updated callback handler to generate JWT tokens for authenticated sessions
package.json Added jose v6.1.2 as a new dependency for JWT token operations
env.example Added JWT_SECRET configuration example for JWT signing
RELEASE_NOTES.md Documented security improvements, breaking changes, and technical implementation details
README.md Added comprehensive documentation for JWT_SECRET including generation instructions and updated authentication requirements

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

skrylnikov and others added 2 commits December 1, 2025 09:13
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Added Zod for JWT payload validation.
- Introduced functions to manage JWT expiration and secure cookie settings.
- Updated README to reflect changes in JWT secret generation requirements.
- Modified session cookie handling to include secure flag based on HTTPS.
- Updated dependencies to use Zod version 4.1.13.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

skrylnikov and others added 3 commits December 1, 2025 09:28
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@skrylnikov skrylnikov merged commit 086642d into main Dec 1, 2025
4 checks passed
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