Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Conversation

@grdsdev
Copy link
Contributor

@grdsdev grdsdev commented May 12, 2025

This pull request introduces UUID validation for user-related operations in both the asynchronous and synchronous versions of the gotrue_admin_api module. It ensures that invalid UUIDs are caught early, preventing unnecessary API calls. Additionally, new tests have been added to verify this behavior.

UUID Validation Enhancements:

  • Added a new helper function is_valid_uuid in supabase_auth/helpers.py to validate UUIDs.
  • Introduced a _validate_uuid method in both supabase_auth/_async/gotrue_admin_api.py and supabase_auth/_sync/gotrue_admin_api.py to validate UUIDs before making API requests. [1] [2]
  • Updated all relevant methods (get_user_by_id, update_user_by_id, delete_user, _list_factors, _delete_factor) in gotrue_admin_api to call _validate_uuid for input validation. [1] [2] [3] [4] [5] [6] [7] [8]

Test Coverage:

  • Added tests in tests/_async/test_gotrue_admin_api.py to verify that invalid UUIDs raise ValueError in all relevant methods.
  • Added equivalent tests in tests/_sync/test_gotrue_admin_api.py for the synchronous API.

Other Changes:

  • Updated imports in supabase_auth/_async/gotrue_admin_api.py and supabase_auth/_sync/gotrue_admin_api.py to include is_valid_uuid. [1] [2]
  • Added uuid import in supabase_auth/helpers.py to support UUID validation.

@grdsdev grdsdev requested a review from silentworks May 12, 2025 16:38
@grdsdev grdsdev marked this pull request as ready for review May 12, 2025 16:38
@grdsdev grdsdev requested a review from staaldraad May 12, 2025 16:38
Copy link
Member

@staaldraad staaldraad left a comment

Choose a reason for hiding this comment

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

nice! 💪🏼

@grdsdev grdsdev merged commit 1649956 into main May 15, 2025
11 checks passed
@grdsdev grdsdev deleted the guilherme/clibs-172-auth-py-validate-uuid-on-admin-methods branch May 15, 2025 08:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants