ssh: reject certificates with an empty principal - #374
XZ-Legendary-56 wants to merge 1 commit into
Conversation
parseCert appended every ValidPrincipals entry from the wire format
without validating it. A certificate with a single empty principal
parsed successfully and passed len(cert.ValidPrincipals) > 0 checks,
so it appeared principal-restricted when it was not: CheckCert("")
matched the empty entry and returned success, and code inspecting
ValidPrincipals directly was misled the same way.
An empty principal has no meaningful interpretation, since an empty
principals list already means the certificate is valid for all users
and hosts. Reject it during parsing so every consumer is covered.
Fixes golang/go#81539
|
This PR (HEAD: a4de142) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/crypto/+/835085. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/835085. |
|
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/835085. |
|
Message from Инал Битоков: Patch Set 1: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/835085. |
parseCert appended every ValidPrincipals entry from the wire format
without validating it. A certificate with a single empty principal
parsed successfully and passed len(cert.ValidPrincipals) > 0 checks,
so it appeared principal-restricted when it was not: CheckCert("")
matched the empty entry and returned success, and code inspecting
ValidPrincipals directly was misled the same way.
An empty principal has no meaningful interpretation, since an empty
principals list already means the certificate is valid for all users
and hosts. Reject it during parsing so every consumer is covered.
Fixes golang/go#81539