-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http/httptest: add fipsonly compliant certificate in for NewTLSServer(), for dev.boringcrypto branch #48674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
CC @neild and maybe @FiloSottile ? |
Change https://golang.org/cl/353869 mentions this issue: |
@gopherbot please open backport issues |
Backport issue(s) opened: #50585 (for 1.16), #50586 (for 1.17). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
Change https://golang.org/cl/380995 mentions this issue: |
Change https://golang.org/cl/380997 mentions this issue: |
…cate Upgrade the test certificate from RSA 1024 (not FIPS-approved) to RSA 2048 (FIPS-approved), allowing tests to pass when the dev.boringcrypto branch FIPS-only mode is enabled. For #48674. Fixes #50585. Change-Id: I613d2f8d0207bf3683fd0df256bf0167604996c5 Reviewed-on: https://go-review.googlesource.com/c/go/+/353869 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Filippo Valsorda <filippo@golang.org> (cherry picked from commit 90860e0) Reviewed-on: https://go-review.googlesource.com/c/go/+/380997 Trust: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
…t certificate Upgrade the test certificate from RSA 1024 (not FIPS-approved) to RSA 2048 (FIPS-approved), allowing tests to pass when the dev.boringcrypto branch FIPS-only mode is enabled. For #48674. Fixes #50586. Change-Id: I613d2f8d0207bf3683fd0df256bf0167604996c5 Reviewed-on: https://go-review.googlesource.com/c/go/+/353869 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Filippo Valsorda <filippo@golang.org> (cherry picked from commit 90860e0) Reviewed-on: https://go-review.googlesource.com/c/go/+/380995 Trust: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
Upgrade the test certificate from RSA 1024 (not FIPS-approved) to RSA 2048 (FIPS-approved), allowing tests to pass when the dev.boringcrypto branch FIPS-only mode is enabled. Fixes golang#48674. Change-Id: I613d2f8d0207bf3683fd0df256bf0167604996c5 Reviewed-on: https://go-review.googlesource.com/c/go/+/353869 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Filippo Valsorda <filippo@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I am using dev.boringcrypto branch for fips compliance in my code. I am facing issues while writing tests using
httptest.NewTLSServer()
Code:
In my code I have an http client which I makes https GET calls.
Testing:
While writing tests I am using
NewTLSServer
function ofhttptest
package for mocking the server. Then I am using Client() method of mock server created. Then I am calling my function which makes the https GET calls (that function will use the client that I got from mock server).As my code has
import _ "crypto/tls/fipsonly"
the test fails. Client fails to verify the server certificate with below error.The issue is the default cert that is used by
NewTLSServer
method ofhttptest
package is not fipsonly compliant.The cert could be found in this file.
Also the test
ExampleConfig_keyLogWriter
here seems to enableInsecureSkipVerify
and has the comment// test server certificate is not trusted.
.Playground link - https://play.golang.org/p/ahA8mKd7sRr (
import _ "crypto/tls/fipsonly"
not present as playground doesn't work on boring crypto branches.)You can add missing import and repro the issue locally.
Note: The code also is bit flaky as it is dependent on multiple goroutine execution. One in 2-3 execution the http GET request would succeed, in other cases select loop will timeout.
What did you expect to see?
Expected the client returned by httptest Server to be compatible and usable in testing, instead we being required to create our own client and set
InsecureSkipVerify
to true for testing.What did you see instead?
Client returned by httptest Server (NewTLSServer()) is not compatible in boring crypto branches.
The text was updated successfully, but these errors were encountered: