Skip to content

fix: redact credentials in object-store URL diagnostics - #25927

Open
goutamadwant wants to merge 2 commits into
apache:mainfrom
goutamadwant:fix/object-store-url-diagnostics-25632
Open

goutamadwant wants to merge 2 commits into
apache:mainfrom
goutamadwant:fix/object-store-url-diagnostics-25632

Conversation

@goutamadwant

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

Object-store URLs can contain credentials, ABFS container identifiers, and query tokens. Debug output and missing-store errors currently expose parts of those URLs in diagnostics.

What changes are included in this PR?

  • Show only the scheme, host, and port in ObjectStoreUrl and registry Debug output and in missing-store errors.
  • Keep URL parsing, display, registry lookup keys, and serialized scan configurations unchanged.
  • Add regression tests for credential redaction, ABFS/ABFSS URLs, registry behavior, and protobuf round-trip preservation.

What is the testing strategy for this PR?

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test -p datafusion-execution (124 unit tests and 19 doc tests passed)
  • cargo test -p datafusion-proto --test proto_integration (266 tests passed)

Are there any user-facing changes?

Debug output and missing-store error messages now omit URL userinfo, paths, queries, and fragments. Object-store lookup and serialized URL behavior are unchanged.

@github-actions github-actions Bot added execution Related to the execution crate proto Related to proto crate labels Oct 1, 2026
@codecov-commenter

codecov-commenter commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.94737% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.90%. Comparing base (1d9be2e) to head (c2f695a).
⚠️ Report is 239 commits behind head on main.

Files with missing lines Patch % Lines
datafusion/execution/src/object_store.rs 98.94% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #25927      +/-   ##
==========================================
+ Coverage   82.58%   82.90%   +0.31%     
==========================================
  Files        1144     1154      +10     
  Lines      441510   458114   +16604     
  Branches   441510   458114   +16604     
==========================================
+ Hits       364615   379786   +15171     
- Misses      54844    55290     +446     
- Partials    22051    23038     +987     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Toby1009 Toby1009 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for working on this, Goutam! This looks good overall and matches the direction discussed in #25632: keep redaction in diagnostics while preserving the underlying URL and existing lookup/serialization behavior.

I especially appreciate the explicit URL assertions in the protobuf round-trip test. Since Debug now hides userinfo, comparing Debug output alone could miss data loss; I verified that the new test catches a deliberately introduced Display-redaction regression.

I reviewed the formatting, registry, and serialization paths. The six object-store unit tests, the new protobuf test, and four additional public-API checks all passed locally on this commit.

I have a few non-blocking suggestions below to clarify the comments and strengthen the regression coverage. These are about guarding against future regressions; I did not find those regressions in the current implementation.

}

/// Format only the scheme, host, and port for diagnostics. Registry keys may
/// include userinfo (for example, an ABFS container), so do not reuse them here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Small documentation suggestion: could we clarify the rationale here? get_url_key() currently removes userinfo for every scheme, including ABFS/ABFSS, so keys inserted through register_store() do not contain the container username. The new registry Debug test creates that state by inserting directly into the private map.

Keeping diagnostic formatting separate from lookup-key construction makes sense. Perhaps the comment could explain that this keeps the redaction policy independent of future changes to registry identity, and describe the registry Debug handling/test as defensive. The similar comment in test_registry_debug_redacts_userinfo_in_keys could use the same clarification.

let message = err.err().unwrap().strip_backtrace();
assert!(message.contains(&expected), "{message}");
for secret in
["u%40ser", "p%40ss", "container", "token=secret", "fragment"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we also assert that the path is omitted? The inputs contain /path, but the negative assertions do not cover it, and message.contains(&expected) still passes if the path is appended to the safe URL.

As a local experiment, I changed only the two error-formatting calls to append url.path(); all six existing object-store tests still passed. The current implementation does remove the path correctly, so this is a coverage suggestion.

Using a distinctive path and asserting that it is absent, or checking a literal expected URL followed by . See, would protect the path-redaction behavior described in the PR.

Url::parse("abfss://container@account.dfs.core.windows.net/path").unwrap();
let store: Arc<dyn ObjectStore> = Arc::new(InMemory::new());
registry.register_store(&url, Arc::clone(&store));
assert!(Arc::ptr_eq(&registry.get_store(&url).unwrap(), &store));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it be useful to extend this with a lookup/deregistration using a different URL that currently resolves to the same key? For example, keep the ABFSS scheme/host/port the same while changing the password and path/query.

Registering and looking up the exact same URL can still pass if both operations change their key construction together. I checked this by temporarily including userinfo in ABFS/ABFSS keys: all six existing object-store tests remained green, while an additional public-API compatibility check failed as expected.

A case with distinct input URLs would give stronger coverage for the promise that registry lookup behavior remains unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

execution Related to the execution crate proto Related to proto crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redact credentials in object-store URL diagnostics

3 participants