2.1 KiB
2.1 KiB
id, name, status, depends_on, scope, risk, impact, level, review_findings
| id | name | status | depends_on | scope | risk | impact | level | review_findings | |
|---|---|---|---|---|---|---|---|---|---|
| fix/normalize-host-ipv6 | Fix normalize_host to handle IPv6 bracket notation | completed | single | low | isolated | implementation |
|
Description
normalize_host in src/config/dynamic_config.rs uses split(':').next() to strip ports, but this fails for IPv6 addresses in brackets (e.g., [::1]:443 would normalize to [::1] instead of ::1). The strip_port_from_host function in src/tls/redirect.rs correctly handles this case.
Changes Required
src/config/dynamic_config.rs:
- Replace the
normalize_hostimplementation with a port-stripping function that handles IPv6 bracket notation - Either extract a shared utility function from
strip_port_from_hostinredirect.rs, or makenormalize_hostuse the same logic - The function should:
- If host starts with
[, find the closing]and strip the port after it - Otherwise, use the existing
split(':').next()logic - Convert to lowercase
- If host starts with
src/tls/redirect.rs:
- Consider extracting
strip_port_from_hostinto a shared module (e.g.,src/utils.rsor inline in both places) to avoid code duplication
Tests
- Add test cases for
normalize_hostwith IPv6:[::1]:443→::1(or[::1]depending on convention — check what the routing table expects)[2001:db8::1]:8080→2001:db8::1- Plain hostname with port:
example.com:443→example.com - Plain hostname without port:
example.com→example.com
Acceptance Criteria
normalize_hostcorrectly strips ports from IPv6 bracket notation- Either a shared utility function is extracted, or both implementations use the same logic
- New test cases for IPv6 host normalization
- Existing routing tests pass
cargo clippypasses with no warnings
References
- docs/reviews/002-implementation-review.md — S3 finding
- src/config/dynamic_config.rs —
normalize_hostfunction - src/tls/redirect.rs —
strip_port_from_hostfunction (correct implementation)
Notes
To be filled by implementation agent
Summary
To be filled on completion