Skip to content

fix: preserve colons in URL usernames - #2828

Merged
Sebastian Thiel (Byron) merged 1 commit into
mainfrom
user-colon-tobstring
Jul 24, 2026
Merged

fix: preserve colons in URL usernames#2828
Sebastian Thiel (Byron) merged 1 commit into
mainfrom
user-colon-tobstring

Conversation

@Byron

@Byron Sebastian Thiel (Byron) commented Jul 24, 2026

Copy link
Copy Markdown
Member

Tasks

This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.

  • refackiew

Everything below this line was generated by Codex GPT-5.

Created by Codex on behalf of Byron. Byron will review before this is ready to merge.

Fixes #2827

Summary

  • percent-encode : when serializing decoded usernames so it cannot become the username/password delimiter
  • retain literal colons in passwords
  • cover the reported parse/serialize/parse round trip

Git baseline

Git a23bace963d508bd96983cc637131392d3face18 treats the first literal colon in URL userinfo as the username/password boundary and percent-decodes the separated fields (credential.c).

Validation

  • cargo test -p gix-url colon_in_username_roundtrips
  • cargo test -p gix-url
  • cargo clippy -p gix-url --all-targets -- -D warnings
  • git diff --check
  • codex review --commit 8fa4fe693e5fd93691e33d0e6adbeadc14386023

@Byron
Sebastian Thiel (Byron) marked this pull request as ready for review July 24, 2026 14:04
Comment thread gix-url/tests/url/parse/http.rs Dismissed
<!-- agent -->

Percent-decoded colons in usernames were serialized literally, causing the
parser to reinterpret the suffix as a password. The regression test shows
that an HTTP username containing a colon did not survive serialization and
reparsing.

Encode colons specifically in the username while retaining the existing
userinfo encoding for passwords, where colons are data.

Git baseline: credential.c at a23bace963d508bd96983cc637131392d3face18
uses the first literal colon as the user/password boundary and percent-decodes
the resulting fields.

Co-authored-by: GPT 5.6 <codex@openai.com>
@Byron
Sebastian Thiel (Byron) merged commit 45ec08d into main Jul 24, 2026
32 checks passed
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.

gix-url: a colon in the user component is not preserved by to_bstring()

2 participants