Skip to content

fix: reject a bracketed host that is not an IPv6 address - #29

Open
SashaMIT wants to merge 1 commit into
distribution:mainfrom
SashaMIT:fix/ipv6-host
Open

SashaMIT wants to merge 1 commit into
distribution:mainfrom
SashaMIT:fix/ipv6-host

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Sep 30, 2026 •

Copy link
Copy Markdown

Parse("[:::]:5000/repo") returned a reference and a nil error. [:::::::]:5000/repo and [fd00123123123]:75050/repo did the same. The name regexp accepts any run of hex digits and colons inside the brackets. The grammar calls that an RFC 3986 IPv6 address, and none of those strings is one.

[::1]:5000/repo, [2001:db8::1]:5000/repo, and [2001:db8::]:5000/repo still parse. A port is still any run of digits, which is what the grammar spells out. The domain regexp stays a prefilter. DomainRegexp still matches [fd00123123123]:75050, and Parse now rejects it.

go test -count=1 -run 'TestReferenceParse/\[:::' failed on tip with missing expected error: invalid reference format and passes after the change. go test . passes. golangci-lint v2 reports no issues.

Parse("[:::]:5000/repo") returned a reference. The name regexp accepts any hex and colons inside the brackets, and "[:::]" is not an IPv6 address.

Signed-off-by: Sasha Mitchell <sash.t.mitchell@gmail.com>
@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.12%. Comparing base (6ccba5a) to head (3e6189a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
reference.go 81.81% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #29      +/-   ##
==========================================
- Coverage   84.21%   84.12%   -0.09%     
==========================================
  Files           5        5              
  Lines         304      315      +11     
==========================================
+ Hits          256      265       +9     
- Misses         38       39       +1     
- Partials       10       11       +1     

☔ 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.

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.

1 participant