Merged
Conversation
This commit upgrades the ruby-jwt dependency to version 3.1, bringing improved security and RFC compliance. - Upgraded jwt gem dependency from ~> 2.8 to ~> 3.1 in workos.gemspec - Updated session test fixture to generate valid base64-encoded JWK data The JWT 3.x series introduced stricter RFC 4648 compliance for base64 encoding/decoding, replacing the more lenient RFC 2045 standard used in 2.x. This provides better security and interoperability with other JWT implementations that follow the stricter standard. Key improvements in JWT 3.x: - Stricter base64 validation that rejects invalid padding and whitespace - Proper base64 encoding/decoding for HMAC JWK keys (the 'k' parameter) - Enhanced security through stricter validation The test fixture in session_spec.rb was updated to use dynamically generated JWK data instead of hardcoded placeholder values.
gjtorikian
approved these changes
Feb 4, 2026
Greptile OverviewGreptile SummaryUpgraded the Key changes:
Security improvements:
The upgrade is backward compatible with existing functionality, as confirmed by the PR description stating all 376 tests pass. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant Gem as workos.gemspec
participant Lock as Gemfile.lock
participant JWT as JWT Library
participant Test as session_spec.rb
participant Session as Session Class
Dev->>Gem: Update jwt dependency to v3.1
Note over Gem: jwt v2.8 to v3.1
Dev->>Lock: Bundle install
Lock->>JWT: Install jwt 3.1.2
Lock->>Lock: Update base64 to 0.3.0
Test->>Test: Generate RSA key pair
Note over Test: OpenSSL PKey RSA new 2048
Test->>JWT: Export JWK with proper base64
Note over JWT: JWK export creates valid encoding
Test->>Test: Create jwks hash from export
Note over Test: Replaces hardcoded values
Test->>Session: Initialize Session with JWKs
Session->>JWT: Decode with stricter validation
Note over JWT: RFC 4648 compliant validation
JWT-->>Session: Success with valid base64
Session-->>Test: All tests pass
|
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.
Description
This commit upgrades the ruby-jwt dependency to version 3.1, bringing improved security and RFC compliance.
The JWT 3.x series introduced stricter RFC 4648 compliance for base64 encoding/decoding, replacing the more lenient RFC 2045 standard used in 2.x. This provides better security and interoperability with other JWT implementations that follow the stricter standard.
Key improvements in JWT 3.x:
The test fixture in session_spec.rb was updated to use dynamically generated JWK data instead of hardcoded placeholder values. This change is both necessary and safe because:
Why Necessary: The old fixture used invalid base64 strings like "test_n", "test", etc. for RSA key parameters. JWT 3.x's stricter validation correctly rejects these as invalid base64, causing tests to fail during JWK parsing.
Why Safe: The new approach generates the jwks_hash from an actual RSA key pair using JWT::JWK.export, ensuring all base64-encoded fields (n, e, x5c, x5t#S256) contain valid cryptographic data. This makes the tests more realistic and robust, as they now use properly formatted JWKs that match what the production code would receive from WorkOS APIs.
The change maintains test isolation and determinism while ensuring compatibility with JWT 3.x's stricter validation.
All 376 existing tests pass with no modifications to production code, confirming that this upgrade is fully backward compatible with the WorkOS SDK's existing functionality.
Closes #402
Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.