Skip to content

Commit 6c2a75f

Browse files
gjtorikianclaude
andcommitted
fix(review): drop dead redact_path entries and unreachable exp.nil? branch
REDACTED_TOKEN_PREFIXES listed /user_management/sessions/authorize and /user_management/sessions/logout, but those URLs are built client-side by UserManagement#get_logout_url / the OAuth authorize-URL helper and never flow through BaseClient#execute, so redact_path is never invoked for them. Even if they were, the URLs carry their identifiers as query parameters, not path segments, and the start_with?("#{prefix}/") guard requires a trailing path segment. Remove the two dead entries — the overstated coverage in the prior commit body did not match the wire. In Session#authenticate, decode_jwt now passes required_claims: ["exp"], so a token missing the claim raises JWT::MissingRequiredClaim (a JWT::DecodeError subclass) and is caught by the existing rescue. The decoded["exp"].nil? half of the is_expired guard is therefore unreachable; drop it so future readers aren't misled about when exp can be absent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a0fe564 commit 6c2a75f

2 files changed

Lines changed: 1 addition & 3 deletions

File tree

lib/workos/base_client.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,6 @@ def shutdown
193193
/user_management/magic_auth
194194
/user_management/password_reset
195195
/user_management/email_verification
196-
/user_management/sessions/authorize
197-
/user_management/sessions/logout
198196
].freeze
199197
private_constant :REDACTED_TOKEN_PREFIXES
200198

lib/workos/session.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def authenticate(include_expired: false, &claim_extractor)
6565
return SessionManager::AuthError.new(authenticated: false, reason: SessionManager::INVALID_JWT)
6666
end
6767

68-
is_expired = decoded["exp"].nil? || decoded["exp"] < Time.now.to_i
68+
is_expired = decoded["exp"] < Time.now.to_i
6969

7070
SessionManager::AuthSuccess.new(
7171
authenticated: !is_expired,

0 commit comments

Comments
 (0)