tsp-tcp: reject malformed endpoint syntax instead of treating every split error as a missing port #9
Labels
No labels
nagonag
nagonag/ignore
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
heiko/mailseal#9
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
internal/tsp-tcp.Newcallsnet.SplitHostPort(addr)and, on every error, assumes the port is missing and callsnet.JoinHostPort(addr, "318").This conflates valid host-without-port input with malformed input. Examples needing explicit behavior include:
tcp://example.com:notaportSome malformed values can be transformed into surprising bracketed hostnames and fail only later during dialing.
Checklist: #49 (validate at the boundary and return contextual errors).
Proposed fix
tcp, no userinfo/path/query/fragment, and a nonempty host.Note that the FreeTSA raw-DER TCP behavior is not RFC 3161 section 3.3 framing; keep protocol compatibility and endpoint syntax as separate concerns.
Acceptance criteria
New, before any network operation.Reviewed against
948b7a9onmaster(Go 1.26.2).Strict endpoint validation and the complete valid/invalid endpoint table are complete.
Closing commit:
b5c194322a89