-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[ci] Run Go unit tests with GODEBUG=fips140=only
#13926
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
base: main
Are you sure you want to change the base?
[ci] Run Go unit tests with GODEBUG=fips140=only
#13926
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13926 +/- ##
==========================================
- Coverage 92.17% 92.16% -0.02%
==========================================
Files 668 668
Lines 41467 41467
==========================================
- Hits 38221 38216 -5
- Misses 2213 2216 +3
- Partials 1033 1035 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
GODEBUG=fips140=only
|
Running Ignoring passing and skipped tests, here are the failures: |
|
I think you can just set GODEBUG as an env var before running make.
Please feel free to open issues for each test occurrence failing, and request fips140-3 be considered for support. |
|
Thanks @atoulme, I'll run the Go unit tests as you suggested. The goal would be to eventually run these unit tests with |
GODEBUG=fips140=onlyGODEBUG=fips140=only
GODEBUG=fips140=onlyGODEBUG=fips140=only
d9eb679 to
b269e9d
Compare
b269e9d to
063717e
Compare
4fbf367 to
c4a20ca
Compare
…EBUG=fips140=only` is set (#14068) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description When #13926 is merged, all unit tests in this repository will be run with `GODEBUG=fips140=only` to help surface any FIPS-140 violations in all the Go modules in this repository. The `cmd/builder` module is not used when _running_ the OpenTelemetry Collector. It is a tool used to _build_ OpenTelemetry Collector distributions. As such, strictly speaking, we do not need to worry about FIPS-140 violations in this module. However, since unit tests for _all_ modules will be run with `GODEBUG=fips140=only`, it is convenient to address any FIPS-140 violations in this module as well. The module is responsible for building OpenTelemetry Collector distributions from a configuration file. The configuration file lists Go modules which are then downloaded in order to compile the distribution. During the download, if `GODEBUG=fips140=only` is set, the following error will be thrown: ``` crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode ``` To suppress this error, we append `tlsmklem=0` to the `GODEBUG` environment variable. This is OK to do because a) we are only doing this from unit test code, not the module's code itself and b) as mentioned above, this particular module is not involved in the running of the OpenTelemetry Collector itself, i.e. we are not suppressing a legitimate FIPS violation in OpenTelemetry Collector code. <!-- Issue number if applicable --> #### Link to tracking issue Fixes #13997 <!--Describe what testing was performed and which tests were added.--> #### Testing Run the existing unit tests in the `cmd/builder` module with Go >= 1.24.6 and `GODEBUG=fips140=only`. ``` cd cmd/builder GODEBUG=fips140=only go test -v ./... -count 1 ```
c4a20ca to
fd1a96e
Compare
…S`] Skip test if `GODEBUG=fips140=only` is set (#14076) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description When #13926 is merged, all unit tests in this repository will be run with `GODEBUG=fips140=only` to help surface any FIPS-140 violations in all the Go modules in this repository. One such unit test that fails in these circumstances is `confmap/provider/internal/configurablehttpprovider.TestFunctionalityDownloadFileHTTPS`. However, the FIPS violation surfaced by this test is from the test code itself (as opposed to from OpenTelemetry Collector core code that the test is exercising), specifically when this call is made: https://github.com/open-telemetry/opentelemetry-collector/blob/0f3b0c974e235da85282c6d6ff5734e55e8f4fbc/confmap/provider/internal/configurablehttpprovider/provider_test.go#L81 As such, this is not a FIPS violation we need to worry about when running the OpenTelemetry Collector. To prevent the unit test from failing when it's run with `GODEBUG=fips140=only`, we skip it. <!-- Issue number if applicable --> #### Link to tracking issue Fixes #13998 <!--Describe what testing was performed and which tests were added.--> #### Testing Run the `configurablehttpprovider.TestFunctionalityDownloadFileHTTPS` unit test with `GODEBUG=fips140=only`. ``` $ cd confmap/ $ GODEBUG=fips140=only go test ./provider/internal/configurablehttpprovider/... -test.v -test.run TestFunctionalityDownloadFileHTTPS -count 1 ```
|
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
fd1a96e to
68db426
Compare
CodSpeed Performance ReportMerging #13926 will degrade performances by 76.23%Comparing
|
| Benchmark | BASE |
HEAD |
Change | |
|---|---|---|---|---|
| ❌ | zstdWithConcurrency |
6.9 µs | 29 µs | -76.23% |
…fips140=only` is set (#14225) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description When #13926 is merged, all unit tests in this repository will be run with `GODEBUG=fips140=only` to help surface any FIPS-140 violations in all the Go modules in this repository. One such unit test that fails in these circumstances is `config/configtls.TestTPM_loadCertificate`. However, the FIPS violation surfaced by this test is from the test code itself (as opposed to from OpenTelemetry Collector core code that the test is exercising), specifically when this call is made: https://github.com/open-telemetry/opentelemetry-collector/blob/974da01f71487422c02fadadb8f66147162fcb14/config/configtls/tpm_test.go#L191 As such, this is not a FIPS violation we need to worry about when running the OpenTelemetry Collector. To prevent the unit test from failing when it's run with `GODEBUG=fips140=only`, we skip it. <!-- Issue number if applicable --> #### Link to tracking issue Fixes #13989 <!--Describe what testing was performed and which tests were added.--> #### Testing Run the `configtls.TestTPM_loadCertificate` unit test with `GODEBUG=fips140=only`. Make sure OS is Linux and Go version is >= 1.24.6. ``` $ cd config/configtls/ $ GODEBUG=fips140=only go test ./... -test.run TestTPM_loadCertificate ```
…EBUG=fips140=only
… -tags=requirefips
e41d32d to
39a20b3
Compare
|
CI failures will be addressed once #14255 is reviewed and merged. |
Description
This PR runs all Golang unit tests in this repository with the
GODEBUG=fips140=onlyenvironment set. This is useful to detect any FIPS-140 violations of code covered by these unit tests.To achieve the above, this PR introduces a new
gotest-fips140-onlytarget inMakefileand a correspondingtest-fips140-onlytarget inMakefile.Common.Link to tracking issue
Relates to #13925
Testing
Documentation