fix(auth): accept uppercase UUIDs in validateUUID#2467
Open
i-anubhav-anand wants to merge 1 commit into
Open
Conversation
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
What changed?
validateUUID()checked its input againstUUID_REGEX, which lacked the case-insensitive (i) flag:As a result, any UUID containing uppercase hex (e.g.
123E4567-E89B-12D3-A456-426614174000) was rejected client-side withExpected parameter to be UUID but is not, before the request was ever sent — even though the value is a perfectly valid UUID and the GoTrue server accepts it.This affects the public admin methods that validate a UUID argument:
getUserById,updateUserById,deleteUser,_listFactors,_deleteFactor,_adminListPasskeys,_adminDeletePasskey.Why was this change needed?
UUIDs are case-insensitive on input. Per RFC 9562 §4 (and RFC 4122 §3): "The hexadecimal values 'a' through 'f' … are case insensitive on input." The GoTrue server (Go
uuidparser) accepts uppercase UUIDs, so rejecting them in the client is incorrect and blocks valid calls.🔄 Breaking changes
📋 Checklist
pnpm nx format📝 Additional notes
Fail-before / pass-after — added uppercase and mixed-case cases to the
validateUUIDtest inhelpers.test.ts:should accept uppercase UUIDandshould accept mixed-case UUIDboth throw@supabase/auth-js: Expected parameter to be UUID but is nothelpers.test.tstests pass