mirror of
https://github.com/zap-proto/zip.git
synced 2026-10-19 15:38:57 +00:00
peerOf was implemented for Linux and stubbed everywhere else, and the stub says the host "does not hand us a peer credential" — which is not true of Darwin. It reports the same thing SO_PEERCRED does, split across two socket options: LOCAL_PEERCRED carries the user and groups, LOCAL_PEERPID the process. The consequence was quiet. A caller identity is either attested by the kernel or asserted by the caller, and every Mac silently had only the second kind, so a check that fails closed on a developer's machine passes in CI for a reason unrelated to the code under test. A credential without a group is refused whole rather than reported with GID 0, for the same reason the stub returns nil instead of an empty Peer: every field of a non-nil Peer came from the kernel. x/sys was already in the module graph and is now a direct requirement at the version it was already resolved to. Co-authored-by: Hanzo Dev <[email protected]>
12 lines
387 B
Go
12 lines
387 B
Go
//go:build !linux && !darwin
|
|
|
|
package zip
|
|
|
|
import "net"
|
|
|
|
// peerOf reports nothing where the OS does not hand us a peer credential.
|
|
// nil is the complete answer, not a placeholder: it says "this host cannot
|
|
// attest the caller", which is exactly what a caller-identity check must see
|
|
// so it fails closed rather than trusting an empty Peer.
|
|
func peerOf(net.Conn) *Peer { return nil }
|