fix(validation): Make unix_addr check useful (#1348)#1536
Open
agentic-sanyam wants to merge 1 commit intogo-playground:masterfrom
Open
fix(validation): Make unix_addr check useful (#1348)#1536agentic-sanyam wants to merge 1 commit intogo-playground:masterfrom
unix_addr check useful (#1348)#1536agentic-sanyam wants to merge 1 commit intogo-playground:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey folks,
This PR finally addresses #1348, where the
unix_addrvalidation was, well, pretty much useless.Turns out,
net.ResolveUnixAddrfor the "unix" network type in Go's standard library always succeeds (it just returns aUnixAddrstruct with the provided name and network). This meant ourisUnixAddrResolvablefunction always returnedtrue, even for non-existent or invalid paths. Definitely not the behavior anyone would expect!I've updated
isUnixAddrResolvableto now leverage the existingisUnixDomainSocketExistsfunction. This provides a much more robust check, ensuring the path actually exists and points to a valid Unix domain socket (or a Linux abstract socket).Naturally, the
TestUnixAddrValidationsuite has been completely overhauled to reflect this new, stricter (and correct!) behavior. This includes:Now
unix_addractually does what users expect it to do! 🎉Cheers!
Fixes #1348