Skip to content

fix(io): ignore @ in paths when extracting usernames - #2141

Merged
c-thiel merged 1 commit into
lakekeeper:mainfrom
sivakumar-mahalingam:fix/2140-location-username-path-at
Oct 19, 2026
Merged

c-thiel merged 1 commit into
lakekeeper:mainfrom
sivakumar-mahalingam:fix/2140-location-username-path-at

Conversation

@sivakumar-mahalingam

@sivakumar-mahalingam sivakumar-mahalingam commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix Location::username() incorrectly interpreting @ characters in object paths as URL user information.

Username extraction now examines only the URL authority and uses the last @ as the user-info separator. Locations such as s3://bucket/foo@bar now correctly report no username, while locations containing credentials continue to work as expected.

Related issue

Closes #2140

How was this tested?

  • Unit tests added or updated

The location tests passed with:

cargo test -p lakekeeper-io --no-default-features --features storage-s3 location::tests --lib

Result: 25 passed, 0 failed.

Formatting was validated using the repository's pinned nightly toolchain.

Checklist

  • CI passes (tests, clippy, formatting): targeted tests and formatting pass locally
  • CLA signed

Summary by CodeRabbit

  • Bug Fixes
    • Usernames are now extracted from the URL authority rather than the path. URLs containing @ only in the path no longer produce an incorrect username, while userinfo followed by a path is handled correctly.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 94ebc81c-fbac-4941-8f3f-591e5b0b0bb2
📥 Commits

Reviewing files that changed from the base of the PR and between 5355a1b and c65f64c.

📒 Files selected for processing: 1
  • crates/io/src/location.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Walkthrough

Location::username now checks for userinfo only in the URL authority. Regression tests cover @ characters in paths, including locations with and without authority userinfo.

Changes

Location username parsing

Layer / File(s) Summary
Parse username from authority
crates/io/src/location.rs
Location::username isolates the authority before parsing userinfo. Tests confirm that a path-only @ returns None and that authority userinfo is parsed when the path also contains @.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: c-thiel

Merge Risk: ⚪ Minimal · up to c65f6

The username parsing change meets the stated path and credential behavior, and the inspected ADLS flow remains consistent. No concrete merge-blocking risk remains; normal checks are appropriate.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: ignoring @ characters in URL paths when extracting usernames.
Linked Issues check Passed The change satisfies issue #2140. Location::username() now reads authority_with_host() instead of authority_and_path and uses rsplit_once('@'). This excludes @ characters that occur only in …
Out of Scope Changes check Passed The diff is limited to the Location::username() implementation and regression tests in crates/io/src/location.rs. These changes directly support issue #2140. No unrelated changes are shown.
Full details: Linked Issues check

Explanation

The change satisfies issue #2140. Location::username() now reads authority_with_host() instead of authority_and_path and uses rsplit_once('@'). This excludes @ characters that occur only in the path and preserves username extraction for s3://user@bucket/foo@bar and s3://user:password@bucket/foo@bar. The updated tests cover all three required cases.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the path with care,
An @ in it stays only there.
The authority gives the name,
The tests confirm the parsing game.
The rabbit hops, the checks all pass.

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

✅ PR Title Formatted Correctly

The title of this PR match the correct format. Thank you!

@c-thiel c-thiel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @sivakumar-mahalingam, nice catch!

For context, this does not change behaviour in most cases. The only caller is ADLS location parsing. When a filesystem is present (abfss://fs@account…/foo@bar), the old code already returned the right value. The wrong result only appeared when there was no filesystem, and that location was rejected before and is still rejected now. Only the error message is clearer. It's still good to have the public API correct and consistent.

@c-thiel
c-thiel merged commit 969b8e9 into lakekeeper:main Oct 19, 2026
73 checks passed
@sivakumar-mahalingam

Copy link
Copy Markdown
Contributor Author

Thanks for the additional context @c-thiel That makes sense, the runtime impact is limited to clearer handling of invalid ADLS locations, while the change keeps the public Location API correct and consistent. Glad I could contribute!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Location::username() treats @ characters in paths as user information

2 participants