]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.26] crypto/x509: fix full email constraint matching
authorRoland Shoemaker <bracewell@google.com>
Wed, 11 Feb 2026 23:16:38 +0000 (15:16 -0800)
committerGopher Robot <gobot@golang.org>
Fri, 6 Mar 2026 00:12:54 +0000 (16:12 -0800)
commita761c9ff70fec8e1089897eebd104a8f31cff2d3
tree4ddc26478e9249e30513f1bdc36e66708097e31e
parent994692847a2cd3efd319f0cb61a07c0012c8a4ff
[release-branch.go1.26] crypto/x509: fix full email constraint matching

For full email addresses (local@domain), we stored a map between the
case sensitive local portion to the case insensitive domain portion, and
used that to check if a email SAN matched the constraint. This could be
abused, because it was a map[string]string, meaning if any two
constraints had the same local portion but different domains, the second
would overwrite the first.

Change the map from map[string]string to map[rfc2821Mailbox]struct{},
where the domain portion of the mailbox is lowercased. When checking for
a match we then check the parsed mailbox against the map, lowercasing
the domain portion of the query when we initially parse the address.
This gives us the same functionality as before, but without the
possibility of one constraint overwriting another.

Thanks to Jakub Ciolek for reporting this issue.

Updates #77952
Fixes #77973
Fixes CVE-2026-27137

Change-Id: Ia405209be6f3b87cf4ac220a645467418dc41805
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3440
Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3620
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/752082
TryBot-Bypass: Gopher Robot <gobot@golang.org>
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/crypto/x509/constraints.go
src/crypto/x509/name_constraints_test.go
src/crypto/x509/verify.go