Skip to content

fix(auth): accept uppercase UUIDs in validateUUID - #2467

Merged
mandarini merged 1 commit into
supabase:masterfrom
i-anubhav-anand:fix/auth-uuid-uppercase
Jul 30, 2026
Merged

fix(auth): accept uppercase UUIDs in validateUUID#2467
mandarini merged 1 commit into
supabase:masterfrom
i-anubhav-anand:fix/auth-uuid-uppercase

Conversation

@i-anubhav-anand

Copy link
Copy Markdown
Contributor

🔍 Description

What changed?

validateUUID() checked its input against UUID_REGEX, which lacked the case-insensitive (i) flag:

-const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/
+const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i

As a result, any UUID containing uppercase hex (e.g. 123E4567-E89B-12D3-A456-426614174000) was rejected client-side with Expected 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 uuid parser) accepts uppercase UUIDs, so rejecting them in the client is incorrect and blocks valid calls.

🔄 Breaking changes

  • This PR contains no breaking changes

📋 Checklist

📝 Additional notes

Fail-before / pass-after — added uppercase and mixed-case cases to the validateUUID test in helpers.test.ts:

  • Before fix:should accept uppercase UUID and should accept mixed-case UUID both throw @supabase/auth-js: Expected parameter to be UUID but is not
  • After fix: ✅ all 26 helpers.test.ts tests pass

@i-anubhav-anand
i-anubhav-anand requested review from a team as code owners June 23, 2026 15:36

@mandarini mandarini left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@i-anubhav-anand thanks for this fix. Can you please rebase your PR so that it will trigger the suite and we can merge?

@i-anubhav-anand
i-anubhav-anand force-pushed the fix/auth-uuid-uppercase branch from 266ebc1 to 23ccf69 Compare July 30, 2026 07:47
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 33d01935-eacb-436f-b62c-af840964cd4d

📥 Commits

Reviewing files that changed from the base of the PR and between 6331898 and 23ccf69.

📒 Files selected for processing (2)
  • packages/core/auth-js/src/lib/helpers.ts
  • packages/core/auth-js/test/helpers.test.ts

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • UUID validation now accepts valid UUIDs containing uppercase or mixed-case hexadecimal characters.
    • Invalid UUID formats continue to be rejected.

Walkthrough

Updated UUID_REGEX to use case-insensitive matching, allowing validateUUID to accept uppercase and mixed-case hexadecimal UUID strings. Added test cases covering these formats while retaining the existing invalid-format test matrix.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@i-anubhav-anand

Copy link
Copy Markdown
Contributor Author

Thanks! I've pushed a fresh commit to retrigger CI (23ccf690) — content is unchanged, just rebased onto latest master. Looks like the workflow runs are queued but sitting in action_required status, so they'll need an approval click from a maintainer to actually execute: https://github.com/supabase/supabase-js/pull/2467/checks. Let me know if there's anything else needed on my end!

@pkg-pr-new

pkg-pr-new Bot commented Jul 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

@supabase/auth-js

npm i https://pkg.pr.new/@supabase/auth-js@2467

@supabase/functions-js

npm i https://pkg.pr.new/@supabase/functions-js@2467

@supabase/postgrest-js

npm i https://pkg.pr.new/@supabase/postgrest-js@2467

@supabase/realtime-js

npm i https://pkg.pr.new/@supabase/realtime-js@2467

@supabase/storage-js

npm i https://pkg.pr.new/@supabase/storage-js@2467

@supabase/supabase-js

npm i https://pkg.pr.new/@supabase/supabase-js@2467

commit: 23ccf69

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 81.305%. remained the same — i-anubhav-anand:fix/auth-uuid-uppercase into supabase:master

@mandarini
mandarini merged commit e138184 into supabase:master Jul 30, 2026
29 checks passed
spydon added a commit to supabase/supabase-flutter that referenced this pull request Aug 6, 2026
…tion (#1656)

## Summary

`uuidRegex` in `packages/supabase_common/lib/src/uuid.dart` only matched
lowercase hexadecimal characters, so `validateUuid` rejected otherwise
valid uppercase or mixed-case UUID strings. UUIDs are case-insensitive
per RFC 9562/4122, and such identifiers are commonly returned by
external identity providers and databases.

This affects `GoTrueAdminOAuthApi.getClient`, `updateClient`,
`deleteClient` and `regenerateClientSecret`, which validate the client
id before issuing the request.

## Changes

- `packages/supabase_common/lib/src/uuid.dart` — pass `caseSensitive:
false` to the UUID `RegExp`.
- `packages/gotrue/test/src/helper_test.dart` — flip the uppercase test
from rejecting to accepting, add a mixed-case case, and update the
`uuidRegex` case test. Non-hexadecimal characters such as `G` are still
rejected.

## Outcome

Implemented.

## Reference

- supabase-js PR supabase/supabase-js#2467
(commit e138184574b9a0f092508ee8d961006c8550b9a8)

Fixes #1649

## Compliance matrix

No change needed. The fix is internal to an existing helper and adds no
public symbols; the capabilities it affects
(`auth.oauth_admin.get_client`, `auth.oauth_admin.update_client`,
`auth.oauth_admin.delete_client`,
`auth.oauth_admin.regenerate_client_secret`) are already `implemented`
in `sdk-compliance.yaml`.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* UUID validation now accepts uppercase and mixed-case hexadecimal
characters.
  * UUID format matching is consistently case-insensitive.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->


SDK-1424
mandarini pushed a commit to supabase/ssr that referenced this pull request Aug 11, 2026
This PR updates `@supabase/supabase-js` to v2.112.3.

**Source**: manual

---

## Release Notes

## v2.112.3

## 2.112.3 (2026-08-11)

### 🩹 Fixes

- **supabase:** add trace context headers to canonical CORS allow-list
([#2603](supabase/supabase-js#2603))
- **supabase:** improve trace propagation sampling and diagnostics
([#2604](supabase/supabase-js#2604))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
## v2.112.2

## 2.112.2 (2026-08-06)

### 🩹 Fixes

- **realtime:** prevent duplicate on bindings
([#2594](supabase/supabase-js#2594))
- **realtime:** clear stale join payload on sign-out
([#2597](supabase/supabase-js#2597))

### ❤️ Thank You

- Filipe Cabaço @filipecabaco
- Vaibhav @7ttp
## v2.112.1

## 2.112.1 (2026-08-05)

### 🩹 Fixes

- **auth:** preserve 5xx error message
([#2587](supabase/supabase-js#2587))
- **realtime:** ensure setAuth doesn't disable token refresh
([#2592](supabase/supabase-js#2592))

### ❤️ Thank You

- Eduardo Gurgel
- Vaibhav @7ttp
## v2.112.0

## 2.112.0 (2026-08-03)

### 🚀 Features

- **supabase:** move OpenTelemetry tracing to opt-in /tracing subpath
([#2583](supabase/supabase-js#2583))

### 🩹 Fixes

- **auth:** accept uppercase UUIDs in validateUUID
([#2467](supabase/supabase-js#2467))
- **postgrest:** honour throwOnError when maybeSingle finds multiple
rows ([#2580](supabase/supabase-js#2580))
- **storage:** resolve createSignedUrls return type mismatch
([#2474](supabase/supabase-js#2474))
- **storage:** expose service error code on StorageApiError
([#2537](supabase/supabase-js#2537))
- **supabase:** forward db retry option
([#2571](supabase/supabase-js#2571))

### ❤️ Thank You

- Anubhav Anand @i-anubhav-anand
- Gourab Singha @gourabsingha1
- Juhef @juheff
- Katerina Skroumpelou @mandarini
- Thribhuvan
- Vaibhav @7ttp
- Zuhef Ahmed @Zuhef

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
mandarini pushed a commit to supabase/supabase that referenced this pull request Aug 11, 2026
This PR updates @supabase/*-js libraries to version 2.112.3.

**Source**: manual

**Changes**:
- Updated @supabase/supabase-js to 2.112.3
- Updated @supabase/auth-js to 2.112.3
- Updated @supabase/realtime-js to 2.112.3
- Updated @supabase/postgest-js to 2.112.3
- Refreshed pnpm-lock.yaml

---

## Release Notes

## v2.112.3

## 2.112.3 (2026-08-11)

### 🩹 Fixes

- **supabase:** add trace context headers to canonical CORS allow-list
([#2603](supabase/supabase-js#2603))
- **supabase:** improve trace propagation sampling and diagnostics
([#2604](supabase/supabase-js#2604))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
## v2.112.2

## 2.112.2 (2026-08-06)

### 🩹 Fixes

- **realtime:** prevent duplicate on bindings
([#2594](supabase/supabase-js#2594))
- **realtime:** clear stale join payload on sign-out
([#2597](supabase/supabase-js#2597))

### ❤️ Thank You

- Filipe Cabaço @filipecabaco
- Vaibhav @7ttp
## v2.112.1

## 2.112.1 (2026-08-05)

### 🩹 Fixes

- **auth:** preserve 5xx error message
([#2587](supabase/supabase-js#2587))
- **realtime:** ensure setAuth doesn't disable token refresh
([#2592](supabase/supabase-js#2592))

### ❤️ Thank You

- Eduardo Gurgel
- Vaibhav @7ttp
## v2.112.0

## 2.112.0 (2026-08-03)

### 🚀 Features

- **supabase:** move OpenTelemetry tracing to opt-in /tracing subpath
([#2583](supabase/supabase-js#2583))

### 🩹 Fixes

- **auth:** accept uppercase UUIDs in validateUUID
([#2467](supabase/supabase-js#2467))
- **postgrest:** honour throwOnError when maybeSingle finds multiple
rows ([#2580](supabase/supabase-js#2580))
- **storage:** resolve createSignedUrls return type mismatch
([#2474](supabase/supabase-js#2474))
- **storage:** expose service error code on StorageApiError
([#2537](supabase/supabase-js#2537))
- **supabase:** forward db retry option
([#2571](supabase/supabase-js#2571))

### ❤️ Thank You

- Anubhav Anand @i-anubhav-anand
- Gourab Singha @gourabsingha1
- Juhef @juheff
- Katerina Skroumpelou @mandarini
- Thribhuvan
- Vaibhav @7ttp
- Zuhef Ahmed @Zuhef
## v2.111.0

## 2.111.0 (2026-07-28)

### 🚀 Features

- **auth:** store PKCE verifiers in per-flow slots to survive
overlapping flows
([#2569](supabase/supabase-js#2569))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
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.

3 participants