feat(postgrest): add URL length validation and timeout protection#1348
Closed
grdsdev wants to merge 4 commits into
Closed
feat(postgrest): add URL length validation and timeout protection#1348grdsdev wants to merge 4 commits into
grdsdev wants to merge 4 commits into
Conversation
Adds two new configuration options to PostgrestClient to prevent indefinite hangs on queries with very long URLs (10k+ characters): - `timeout`: Optional int (milliseconds) to auto-abort requests via Future.timeout, propagated through PostgrestClientOptions - `urlLengthLimit`: Max URL length (default 8000) before logging a warning, guiding users toward views or RPC functions for large queries Both options propagate from PostgrestClient through all builders (PostgrestQueryBuilder, PostgrestRpcBuilder) and from SupabaseClient via PostgrestClientOptions. Acceptance Criteria: - [x] timeout option added to PostgrestClient and SupabaseClient - [x] urlLengthLimit option added with default of 8000 - [x] URL length validation before request execution - [x] Timeout auto-cancels requests via Future.timeout - [x] Unit tests cover timeout and URL length scenarios Linear: SDK-698 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ilder Use local variable extraction to enable null promotion for final fields in PostgrestBuilder that could not be promoted due to class inheritance. This fixes dart test compilation errors affecting all test files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fdf65a3 to
ba1d22e
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…eout changes Remove unnecessary null assertion operators on final field `_timeout` (Dart promotes final fields through null checks). Remove unused optional parameters `statusCode` and `body` from test HTTP client helpers. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
timeout(optionalint, milliseconds) toPostgrestClient— wraps requests withFuture.timeoutto auto-abort slow requestsurlLengthLimit(default 8000) to log a warning before requests with very long URLs that may exceed server limitsPostgrestClientOptionsthrough all builders andSupabaseClientChanges
PostgrestClient: Newtimeout: int?andurlLengthLimit: intfieldsPostgrestBuilder._execute(): Checks URL length and logs warning; wraps HTTP calls withFuture.timeoutRawPostgrestBuilder._copyWithType(): Propagates both fields through builder chainPostgrestQueryBuilder/PostgrestRpcBuilder: Accept and forward both fieldsPostgrestClientOptions: Exposes both options toSupabaseClientusersSupabaseClient: Passes options when creatingPostgrestClientandSupabaseQueryBuilderSupabaseQueryBuilder/SupabaseQuerySchema: Accept and forward both fieldsTesting
timeout_url_length_test.dart— 8/8 passingRisk Assessment
Acceptance Criteria
timeoutoption added to PostgrestClient and SupabaseClienturlLengthLimitoption added with default of 8000Future.timeoutCloses: SDK-698
Related: SDK-646
🤖 Generated with Claude Code
/take