-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[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
[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.13% 92.12% -0.02%
==========================================
Files 668 668
Lines 41529 41529
==========================================
- Hits 38263 38258 -5
- Misses 2230 2233 +3
- Partials 1036 1038 +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 this PR will not alter performanceComparing
|
39a20b3 to
a72a473
Compare
a72a473 to
fe1fab2
Compare
…EBUG=fips140=only
… -tags=requirefips
fe1fab2 to
e32b4fe
Compare
|
Hi @TylerHelmuth, thanks for reviewing this PR. Do any additional labels need to be added for it to be considered for merging? Thanks again. |
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