Repository navigation
fix(logging): drop presigned query from request errors and debug URLs - #454
Conversation
There was a problem hiding this comment.
Verdict: 1 Low
Looks good: redaction is applied at the main places URLs get logged or put into errors, and the tests would fail if the redaction were removed. One low finding: a request-build error path in the HTTP client's retry loop still formats the raw reqwest error.
There was a problem hiding this comment.
Verdict: 1 Low
Looks good. The redaction is applied in the right places, and the tests are real regressions (each would fail without its redaction). One low issue: redact_url gets the host wrong when a URL with no path has an @ in its query. Nit, not in this diff: CloudFetchLink derives Debug (src/types/cloudfetch.rs:110), so any future {:?} of a link would print the presigned URL. A redacting Debug impl would close that gap.
|
Re the review-body nit on |
There was a problem hiding this comment.
Verdict: 1 Low
The redaction looks correct and well tested. I have one low-severity concern: the parsed-envelope message arm of http_error still skips redaction. I checked the other URL and error formatting sites (the retry loop, the chunk downloader, the SEA parse errors, the proxy config, and the Azure redirect probe, which isn't presigned), and none of them leak a credential.
reqwest's error Display prints the request URL, so a timed-out or reset CloudFetch download put the SAS/S3 signature into the retry warning and the returned error. Strip the query from the URL inside the reqwest error, log each request's URL only up to `?`, and drop the URL from the chunk download debug line. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
|
Rewritten to the minimal fix (3c23246, rebased on main ca0e096). The only change is on the request-error path: the query is stripped from the URL inside the reqwest error, the per-request debug URL stops at |
The log-capturing test failed about one in three full runs (and every run of the client::http subset): tests in the unit-test binary that open a session install a process-global tracing subscriber, and the test's thread-local capture then missed the retry warning and request lines. Move it to tests/presigned_url_logging.rs, where it is the only test and installs the global subscriber itself, like tests/klog_bridge.rs. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
CloudFetch presigned URLs carry their credential in the query string (Azure SAS
sig=, S3X-Amz-Signature). reqwest's errorDisplayprints the request URL (error sending request for url (…)), and the HTTP client copies that text into its retry warning and the returned error. So a timed-out or reset CloudFetch download wrote a usable signed URL to a default-onwarnline, and the Node.js and Python kernel bindings forward that line to the console. The per-request and chunk-download debug lines printed the full URL too.This strips the query from the URL inside the reqwest error before it is formatted, keeping scheme, host and path so a blocked storage host is still visible. Each request's debug line logs the URL only up to
?, and the "Downloading chunk" debug line drops the URL (the request line already shows host and path).Testing:
tests/presigned_url_logging.rssends a CloudFetch request with?sig=…to a closed port with one retry, capturing DEBUG logs. It fails if either half is reverted: without the error fix the returned error contains?sig=SECRET, and without the debug change the request line does. It runs in its own binary because, in the unit-test binary, tests that open a session install a globaltracingsubscriber and a thread-local capture misses events.cargo +stable fmt --all --check,cargo clippy --all-targets -- -D warningsandcargo testpass.f436057, SEA, against an Azure warehouse, running databricks-driver-testCLOUDFETCH-003(stalled download) andCLOUDFETCH-004(connection reset), serial, each failure injected before response headers:sig=/X-Amz-*ca0e096Chunk 1 download failed (attempt 1/5): … error sending request for url (https://…blob.core.windows.net/…/results_…?sig=…)…/results_<id>): operation timed outand…): client error (SendRequest)Not in this PR:
SignatureDoesNotMatchbody, URLs in a JSON error envelope'smessage,user:password@in a proxy URL, and redactingDebugimpls forCloudFetchLink/ExternalLink. Thechunk_downloader.rsbuild and body-read errors carry no URL, so they need no change.internal/rows/arrowbased/batchloader.go:518-519wraps a*url.Errorwith the signed URL), pure Python (common/unified_http_client.py:306,316,cloudfetch/downloader.py:166-171), and the legacy C# driver in apache/arrow-adbc (CloudFetchDownloader.cs:483).This pull request and its description were written by Isaac.