diff options
author | Damien Neil <dneil@google.com> | 2021-06-10 10:50:37 -0700 |
---|---|---|
committer | Damien Neil <dneil@google.com> | 2021-06-10 20:20:58 +0000 |
commit | 770f1de8c54256d5b17447028e47b201ba8e62c8 (patch) | |
tree | 97fc72286cc4da4a5d2c92ce8f152235049fcee5 /src/net/http/transport_test.go | |
parent | 8d11b1d1172817359d08231deaf29f72d315b762 (diff) | |
download | go-770f1de8c54256d5b17447028e47b201ba8e62c8.tar.gz go-770f1de8c54256d5b17447028e47b201ba8e62c8.zip |
net/http: remove test-only private key from production binaries
The net/http/internal package contains a PEM-encoded private key used in
tests. This key is initialized at init time, which prevents it from
being stripped by the linker in non-test binaries.
Move the certificate and key to a new net/http/internal/testcert
package to ensure it is only included in binaries that reference it.
Fixes #46677.
Change-Id: Ie98bda529169314cc791063e7ce4d99ef99113c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/326771
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/net/http/transport_test.go')
-rw-r--r-- | src/net/http/transport_test.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/net/http/transport_test.go b/src/net/http/transport_test.go index dcaacece61..690e0c299d 100644 --- a/src/net/http/transport_test.go +++ b/src/net/http/transport_test.go @@ -30,7 +30,7 @@ import ( "net/http/httptest" "net/http/httptrace" "net/http/httputil" - "net/http/internal" + "net/http/internal/testcert" "net/textproto" "net/url" "os" @@ -4299,7 +4299,7 @@ func TestTransportReuseConnEmptyResponseBody(t *testing.T) { // Issue 13839 func TestNoCrashReturningTransportAltConn(t *testing.T) { - cert, err := tls.X509KeyPair(internal.LocalhostCert, internal.LocalhostKey) + cert, err := tls.X509KeyPair(testcert.LocalhostCert, testcert.LocalhostKey) if err != nil { t.Fatal(err) } |