Redirect walker followups: hostname/port match + RFC 303 test docstring - #1868
Open
jacalata wants to merge 1 commit into
Open
Redirect walker followups: hostname/port match + RFC 303 test docstring#1868jacalata wants to merge 1 commit into
jacalata wants to merge 1 commit into
Conversation
Two adjustments from a post-merge fresh-eyes pass: - endpoint.py: the http -> https address-promotion match now compares hostnames case-insensitively (RFC 3986) and normalizes http://host vs http://host:80 so a same-host promotion doesn't silently drop. Split into two comparisons: current-vs-next is hostname-only (schemes differ so default port differs, comparing raw netloc would spuriously mismatch); old-address-vs-current is same-scheme and uses (hostname, effective port) so explicit-vs-implicit port compares equal. Expanded the auth-material comment to acknowledge that sign_in itself carries raw credentials in the POST body, not only the issued token on subsequent calls. - test_redirect_handling.py: added a docstring on test_all_supported_redirect_codes_preserve_post_body naming the RFC 7231 6.4.4 deviation on 303 -- if a future refactor "helpfully" converts 303 to GET, the parametrized test fails with a clear intent statement. Also considered a sign_in namespace-detect hedge for pre-8.3 Tableau responses (Copilot flagged this on #1848); dropped as theoretical because TSC's minimum_supported_server_version = 2.3 (Tableau 10.0, 2016) is eight years past the namespace change, and #1863 removes the whole subsystem anyway.
There was a problem hiding this comment.
🟡 Changes recommended
Port promotion can persist an incorrect HTTPS endpoint, and unrestricted cross-host credential replay remains unsafe.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Refines manual redirect handling and documents intentional POST preservation for HTTP 303 responses.
Changes:
- Normalizes hostname and port comparisons during HTTP-to-HTTPS promotion.
- Expands documentation of credential forwarding across redirects.
- Documents intentional RFC 7231 deviation for 303 responses.
File summaries
| File | Description |
|---|---|
tableauserverclient/server/endpoint/endpoint.py |
Refines redirect address promotion and credential-policy comments. |
test/test_redirect_handling.py |
Explains intentional POST preservation for 303 redirects. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+277
to
+280
| # The HTTPS -> HTTP downgrade guard above (line 208) is the | ||
| # boundary that keeps this from becoming a security regression: | ||
| # once the caller connects over HTTPS, credentials never leave | ||
| # TLS to a downgraded target. |
Comment on lines
+246
to
+248
| current_host = (current_parsed.hostname or "").lower() | ||
| next_host = (next_parsed.hostname or "").lower() | ||
| if current_host and current_host == next_host: |
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.
Followup to #1848 (merged). Two small items from a post-merge
fresh-eyes review, kept off #1848 so the merged PR's approval + history
stayed clean.
Changes
endpoint.py: the http -> https address-promotion match nowcompares hostnames case-insensitively per RFC 3986 and normalizes
http://host vs http://host:80 so the same-host check doesn't
silently drop legitimate promotions. Rewritten as two comparisons:
current vs next (same-host across schemes, hostname only), and
old_address vs current (same-scheme, hostname+port with default-
port normalization). Also expanded the auth-material comment to
acknowledge that sign_in itself carries raw credentials (PAT
secret or username+password) in the POST body, not only the
issued token on subsequent calls.
test/test_redirect_handling.py: added a docstring ontest_all_supported_redirect_codes_preserve_post_bodynaming theRFC 7231 6.4.4 deviation on 303, so a future refactor that
"helpfully" converts 303 to GET fails this test with a clear
intent statement.
Test plan
test/test_redirect_handling.py: 26 passNot addressed here (per fresh-eyes review)
dropped as theoretical. TSC's
minimum_supported_server_version = 2.3(Tableau 10.0, 2016) is eight years past the namespacechange, and Proposed: Remove pre-8.3 XML namespace fallback #1863 removes the whole
Namespace.detectsubsystemanyway.
requestshas; [tabcmd] fix: preserve POST body across 3xx redirects (#1127, #1828) #1848's walker doesn't rewind non-seekable data. Separate
policy decision.
_blocking_requestdirectly, so the initial-request threadedprogress indicator is lost. Separate refactor.
🤖 Generated with Claude Code