Add is_valid_url row-level check - #1457
Open
ghanse wants to merge 3 commits into
Open
Conversation
Adds a row-level check that validates URL format against the RFC 3986 §4.3 absolute-URI grammar: scheme ":" hier-part with an optional "?" query and "#" fragment. A scheme is required, so relative references such as "/path" or "example.com" are rejected, and reserved characters must be percent-encoded to be accepted inside a path, query, or fragment. Follows the existing DQPattern approach used by is_valid_email and is_valid_ipv4_address, so the check itself is a thin _matches_pattern call. Any syntactically valid scheme is accepted, which keeps non-network URLs such as s3://, ftp://, mailto: and urn: valid alongside http:// and https://. Two consequences are documented in the docstring and the reference table: the check validates URL *syntax* and not safety, so script-bearing schemes (javascript:alert(1)) and inline data: payloads pass and it must not be used to sanitize untrusted input; and RFC 3986 permits an empty host, so file:///path passes. The pattern is anchored with \A...\z rather than ^...$ so that a value with a trailing newline is rejected under Java regex semantics, consistent with the fix in issue #1440. Every repetition in the pattern is over alternatives with disjoint first characters, so there is no catastrophic backtracking; this was verified against pathological multi-kilobyte inputs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1457 +/- ##
==========================================
- Coverage 93.55% 92.14% -1.41%
==========================================
Files 133 141 +8
Lines 12544 13591 +1047
Branches 0 151 +151
==========================================
+ Hits 11735 12524 +789
- Misses 809 999 +190
- Partials 0 68 +68
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
✅ 988/988 passed, 2 flaky, 42 skipped, 5h20m40s total Flaky tests:
Running from acceptance #5626 |
Contributor
|
❌ 1 failed, 29m2s total ❌ test_mcp_server_end_to_end: requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) (29m1.838s)Running from mcp #375 |
Contributor
|
✅ 195/195 passed, 1 skipped, 7h1m32s total Running from anomaly #1740 |
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.
Changes
Adds a new row-level check
is_valid_url(column)that validates URL format against the RFC 3986 4.3 absolute-URI grammar. A scheme is required, so relative references such as/pathorexample.comare rejected. Reserved characters must be percent-encoded.Linked issues
Tests
Documentation and Demos
This pull request and its description were co-written by Isaac.