- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.8k
Description
Component(s)
No response
Describe the issue you're reporting
Running the cmd/builder unit tests with GODEBUG=fips140=only exposes any calls (direct or indirect) to non-FIPS140-compliant algorithms.
Such calls may be made by the test's code or from collector code exercised by the test. Also, the calls may be true positives or false positives (e.g. using md5, which is not FIPS140-compliant for cryptographic uses, in a non-cryptographic context, e.g. hashing for checksums).  Depending on where the calls are being made from (test code or collector code) and whether they're true or false positives, we may need to either a) provide an alternative implementation — using the requirefips build tag — for the calls with ones to FIPS-compliant algorithms, b) skip the test when GODEBUG=fips140=only (should be done only if the calls are being made from the test code itself), or c) disable the code paths leading to the calls when the module is built with the requirefips build tag and document this (least preferred option).
Steps to reproduce
- 
Make sure Go version is >= 1.24.6. $ go version go version go1.25.1 darwin/arm64
- 
Run the cmd/builderpackage unit tests withGODEBUG=fips140=only.$ cd cmd/builder/ $ GODEBUG=fips140=only go test ./... -test.v -count 1
Observed output
?   	go.opentelemetry.io/collector/cmd/builder	[no test files]
=== RUN   TestCommand
=== RUN   TestCommand/command_created
--- PASS: TestCommand (0.00s)
    --- PASS: TestCommand/command_created (0.00s)
=== RUN   TestApplyFlags
=== RUN   TestApplyFlags/Default_flag_values
=== RUN   TestApplyFlags/All_flag_values
--- PASS: TestApplyFlags (0.00s)
    --- PASS: TestApplyFlags/Default_flag_values (0.00s)
    --- PASS: TestApplyFlags/All_flag_values (0.00s)
=== RUN   TestInitConfig
=== RUN   TestInitConfig/initConfig_created_correctly
2025-10-10T14:25:45.588-0700	INFO	internal/command.go:98	OpenTelemetry Collector Builder	{"version": "(devel)"}
2025-10-10T14:25:45.589-0700	INFO	internal/command.go:107	Using default build configuration
--- PASS: TestInitConfig (0.00s)
    --- PASS: TestInitConfig/initConfig_created_correctly (0.00s)
PASS
ok  	go.opentelemetry.io/collector/cmd/builder/internal	0.274s
=== RUN   TestAliases
--- PASS: TestAliases (0.00s)
=== RUN   TestParseModules
--- PASS: TestParseModules (0.00s)
=== RUN   TestInvalidConverter
--- PASS: TestInvalidConverter (0.00s)
=== RUN   TestRelativePath
--- PASS: TestRelativePath (0.00s)
=== RUN   TestModuleFromCore
--- PASS: TestModuleFromCore (0.00s)
=== RUN   TestMissingModule
--- PASS: TestMissingModule (0.00s)
=== RUN   TestNewDefaultConfig
2025-10-10T14:25:45.775-0700	INFO	builder/config.go:160	Using go	{"go-executable": "/Users/shaunak/.gvm/gos/go1.25.1/bin/go"}
--- PASS: TestNewDefaultConfig (0.00s)
=== RUN   TestNewBuiltinConfig
    logger.go:146: 2025-10-10T14:25:45.776-0700	INFO	Using go	{"go-executable": "/Users/shaunak/.gvm/gos/go1.25.1/bin/go"}
--- PASS: TestNewBuiltinConfig (0.00s)
=== RUN   TestSkipGoValidation
--- PASS: TestSkipGoValidation (0.00s)
=== RUN   TestSkipGoInitialization
--- PASS: TestSkipGoInitialization (0.00s)
=== RUN   TestBuildTagConfig
--- PASS: TestBuildTagConfig (0.00s)
=== RUN   TestDebugOptionSetConfig
--- PASS: TestDebugOptionSetConfig (0.00s)
=== RUN   TestAddsDefaultProviders
--- PASS: TestAddsDefaultProviders (0.00s)
=== RUN   TestSkipsNilFieldValidation
--- PASS: TestSkipsNilFieldValidation (0.00s)
=== RUN   TestGenerateDefault
2025-10-10T14:25:45.778-0700	INFO	builder/main.go:99	Sources created	{"path": "/var/folders/mc/qr61t2n91z3g63ffq5sy4cm00000gn/T/otelcol-distribution298259670"}
--- PASS: TestGenerateDefault (0.00s)
=== RUN   TestGenerateInvalidOutputPath
--- PASS: TestGenerateInvalidOutputPath (0.00s)
=== RUN   TestVersioning
=== RUN   TestVersioning/defaults
2025-10-10T14:25:45.780-0700	INFO	builder/main.go:99	Sources created	{"path": "/var/folders/mc/qr61t2n91z3g63ffq5sy4cm00000gn/T/otelcol-distribution3114032825"}
    main_test.go:220: 
        	Error Trace:	/Users/shaunak/development/github/opentelemetry-collector/cmd/builder/internal/builder/main_test.go:220
        	Error:      	Target error should be in err chain:
        	            	expected: ""
        	            	in chain: "failed to update go.mod: go subcommand failed with args '[mod tidy -compat=1.24]': exit status 1, error message: go: github.com/knadh/koanf/[email protected]: Get \"https://proxy.golang.org/github.com/knadh/koanf/maps/@v/v0.1.2.mod\": crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode\n"
        	            		"go subcommand failed with args '[mod tidy -compat=1.24]': exit status 1, error message: go: github.com/knadh/koanf/[email protected]: Get \"https://proxy.golang.org/github.com/knadh/koanf/maps/@v/v0.1.2.mod\": crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode\n"
        	            		"exit status 1"
        	Test:       	TestVersioning/defaults
=== RUN   TestVersioning/only_gomod_file,_skip_generate
2025-10-10T14:25:45.971-0700	INFO	builder/main.go:74	Skipping generating source codes.
=== RUN   TestVersioning/old_component_version
2025-10-10T14:25:46.028-0700	INFO	builder/main.go:99	Sources created	{"path": "/var/folders/mc/qr61t2n91z3g63ffq5sy4cm00000gn/T/otelcol-distribution629398163"}
    main_test.go:220: 
        	Error Trace:	/Users/shaunak/development/github/opentelemetry-collector/cmd/builder/internal/builder/main_test.go:220
        	Error:      	Target error should be in err chain:
        	            	expected: ""
        	            	in chain: "failed to update go.mod: go subcommand failed with args '[mod tidy -compat=1.24]': exit status 1, error message: go: github.com/knadh/koanf/[email protected]: Get \"https://proxy.golang.org/github.com/knadh/koanf/maps/@v/v0.1.2.mod\": crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode\n"
        	            		"go subcommand failed with args '[mod tidy -compat=1.24]': exit status 1, error message: go: github.com/knadh/koanf/[email protected]: Get \"https://proxy.golang.org/github.com/knadh/koanf/maps/@v/v0.1.2.mod\": crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode\n"
        	            		"exit status 1"
        	Test:       	TestVersioning/old_component_version
=== RUN   TestVersioning/old_component_version_without_strict_mode
2025-10-10T14:25:46.224-0700	INFO	builder/main.go:99	Sources created	{"path": "/var/folders/mc/qr61t2n91z3g63ffq5sy4cm00000gn/T/otelcol-distribution4091932929"}
    main_test.go:220: 
        	Error Trace:	/Users/shaunak/development/github/opentelemetry-collector/cmd/builder/internal/builder/main_test.go:220
        	Error:      	Target error should be in err chain:
        	            	expected: ""
        	            	in chain: "failed to update go.mod: go subcommand failed with args '[mod tidy -compat=1.24]': exit status 1, error message: go: github.com/knadh/koanf/[email protected]: Get \"https://proxy.golang.org/github.com/knadh/koanf/maps/@v/v0.1.2.mod\": crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode\n"
        	            		"go subcommand failed with args '[mod tidy -compat=1.24]': exit status 1, error message: go: github.com/knadh/koanf/[email protected]: Get \"https://proxy.golang.org/github.com/knadh/koanf/maps/@v/v0.1.2.mod\": crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode\n"
        	            		"exit status 1"
        	Test:       	TestVersioning/old_component_version_without_strict_mode
--- FAIL: TestVersioning (0.65s)
    --- FAIL: TestVersioning/defaults (0.19s)
    --- PASS: TestVersioning/only_gomod_file,_skip_generate (0.06s)
    --- FAIL: TestVersioning/old_component_version (0.19s)
    --- FAIL: TestVersioning/old_component_version_without_strict_mode (0.21s)
=== RUN   TestSkipGenerate
2025-10-10T14:25:46.431-0700	INFO	builder/main.go:74	Skipping generating source codes.
--- PASS: TestSkipGenerate (0.00s)
=== RUN   TestGenerateAndCompile
=== RUN   TestGenerateAndCompile/Default_Configuration_Compilation
2025-10-10T14:25:46.434-0700	INFO	builder/config.go:160	Using go	{"go-executable": "/Users/shaunak/.gvm/gos/go1.25.1/bin/go"}
2025-10-10T14:25:46.439-0700	INFO	builder/main.go:99	Sources created	{"path": "/var/folders/mc/qr61t2n91z3g63ffq5sy4cm00000gn/T/TestGenerateAndCompileDefault_Configuration_Compilation3540330638/001"}
    main_test.go:338: 
        	Error Trace:	/Users/shaunak/development/github/opentelemetry-collector/cmd/builder/internal/builder/main_test.go:338
        	Error:      	Received unexpected error:
        	            	failed to update go.mod: go subcommand failed with args '[mod tidy -compat=1.24]': exit status 1, error message: go: github.com/knadh/koanf/[email protected]: Get "https://proxy.golang.org/github.com/knadh/koanf/maps/@v/v0.1.2.mod": crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode
        	Test:       	TestGenerateAndCompile/Default_Configuration_Compilation
=== RUN   TestGenerateAndCompile/LDFlags_Compilation
2025-10-10T14:25:46.649-0700	INFO	builder/config.go:160	Using go	{"go-executable": "/Users/shaunak/.gvm/gos/go1.25.1/bin/go"}
2025-10-10T14:25:46.654-0700	INFO	builder/main.go:99	Sources created	{"path": "/var/folders/mc/qr61t2n91z3g63ffq5sy4cm00000gn/T/TestGenerateAndCompileLDFlags_Compilation207487940/001"}
    main_test.go:338: 
        	Error Trace:	/Users/shaunak/development/github/opentelemetry-collector/cmd/builder/internal/builder/main_test.go:338
        	Error:      	Received unexpected error:
        	            	failed to update go.mod: go subcommand failed with args '[mod tidy -compat=1.24]': exit status 1, error message: go: github.com/knadh/koanf/[email protected]: Get "https://proxy.golang.org/github.com/knadh/koanf/maps/@v/v0.1.2.mod": crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode
        	Test:       	TestGenerateAndCompile/LDFlags_Compilation
=== RUN   TestGenerateAndCompile/GCFlags_Compilation
2025-10-10T14:25:46.872-0700	INFO	builder/config.go:160	Using go	{"go-executable": "/Users/shaunak/.gvm/gos/go1.25.1/bin/go"}
2025-10-10T14:25:46.879-0700	INFO	builder/main.go:99	Sources created	{"path": "/var/folders/mc/qr61t2n91z3g63ffq5sy4cm00000gn/T/TestGenerateAndCompileGCFlags_Compilation2680082659/001"}
    main_test.go:338: 
        	Error Trace:	/Users/shaunak/development/github/opentelemetry-collector/cmd/builder/internal/builder/main_test.go:338
        	Error:      	Received unexpected error:
        	            	failed to update go.mod: go subcommand failed with args '[mod tidy -compat=1.24]': exit status 1, error message: go: github.com/knadh/koanf/[email protected]: Get "https://proxy.golang.org/github.com/knadh/koanf/maps/@v/v0.1.2.mod": crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode
        	Test:       	TestGenerateAndCompile/GCFlags_Compilation
=== RUN   TestGenerateAndCompile/Build_Tags_Compilation
2025-10-10T14:25:47.104-0700	INFO	builder/config.go:160	Using go	{"go-executable": "/Users/shaunak/.gvm/gos/go1.25.1/bin/go"}
2025-10-10T14:25:47.108-0700	INFO	builder/main.go:99	Sources created	{"path": "/var/folders/mc/qr61t2n91z3g63ffq5sy4cm00000gn/T/TestGenerateAndCompileBuild_Tags_Compilation3797942338/001"}
    main_test.go:338: 
        	Error Trace:	/Users/shaunak/development/github/opentelemetry-collector/cmd/builder/internal/builder/main_test.go:338
        	Error:      	Received unexpected error:
        	            	failed to update go.mod: go subcommand failed with args '[mod tidy -compat=1.24]': exit status 1, error message: go: github.com/knadh/koanf/[email protected]: Get "https://proxy.golang.org/github.com/knadh/koanf/maps/@v/v0.1.2.mod": crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode
        	Test:       	TestGenerateAndCompile/Build_Tags_Compilation
=== RUN   TestGenerateAndCompile/Debug_Compilation
    main_test.go:338: 
        	Error Trace:	/Users/shaunak/development/github/opentelemetry-collector/cmd/builder/internal/builder/main_test.go:338
        	Error:      	Received unexpected error:
        	            	failed to update go.mod: go subcommand failed with args '[mod tidy -compat=1.24]': exit status 1, error message: go: github.com/knadh/koanf/[email protected]: Get "https://proxy.golang.org/github.com/knadh/koanf/maps/@v/v0.1.2.mod": crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode
        	Test:       	TestGenerateAndCompile/Debug_Compilation
=== RUN   TestGenerateAndCompile/No_providers
2025-10-10T14:25:47.532-0700	INFO	builder/config.go:160	Using go	{"go-executable": "/Users/shaunak/.gvm/gos/go1.25.1/bin/go"}
2025-10-10T14:25:47.536-0700	INFO	builder/main.go:99	Sources created	{"path": "/var/folders/mc/qr61t2n91z3g63ffq5sy4cm00000gn/T/TestGenerateAndCompileNo_providers253431803/001"}
    main_test.go:338: 
        	Error Trace:	/Users/shaunak/development/github/opentelemetry-collector/cmd/builder/internal/builder/main_test.go:338
        	Error:      	Received unexpected error:
        	            	failed to update go.mod: go subcommand failed with args '[mod tidy -compat=1.24]': exit status 1, error message: go: github.com/knadh/koanf/[email protected]: Get "https://proxy.golang.org/github.com/knadh/koanf/maps/@v/v0.1.2.mod": crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode
        	Test:       	TestGenerateAndCompile/No_providers
=== RUN   TestGenerateAndCompile/With_confmap_factories
2025-10-10T14:25:47.751-0700	INFO	builder/config.go:160	Using go	{"go-executable": "/Users/shaunak/.gvm/gos/go1.25.1/bin/go"}
2025-10-10T14:25:47.756-0700	INFO	builder/main.go:99	Sources created	{"path": "/var/folders/mc/qr61t2n91z3g63ffq5sy4cm00000gn/T/TestGenerateAndCompileWith_confmap_factories3504265368/001"}
    main_test.go:338: 
        	Error Trace:	/Users/shaunak/development/github/opentelemetry-collector/cmd/builder/internal/builder/main_test.go:338
        	Error:      	Received unexpected error:
        	            	failed to update go.mod: go subcommand failed with args '[mod tidy -compat=1.24]': exit status 1, error message: go: github.com/knadh/koanf/[email protected]: Get "https://proxy.golang.org/github.com/knadh/koanf/maps/@v/v0.1.2.mod": crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode
        	Test:       	TestGenerateAndCompile/With_confmap_factories
=== RUN   TestGenerateAndCompile/ConfResolverDefaultURIScheme_set
2025-10-10T14:25:47.976-0700	INFO	builder/config.go:160	Using go	{"go-executable": "/Users/shaunak/.gvm/gos/go1.25.1/bin/go"}
2025-10-10T14:25:47.988-0700	INFO	builder/main.go:99	Sources created	{"path": "/var/folders/mc/qr61t2n91z3g63ffq5sy4cm00000gn/T/TestGenerateAndCompileConfResolverDefaultURIScheme_set141629704/001"}
    main_test.go:338: 
        	Error Trace:	/Users/shaunak/development/github/opentelemetry-collector/cmd/builder/internal/builder/main_test.go:338
        	Error:      	Received unexpected error:
        	            	failed to update go.mod: go subcommand failed with args '[mod tidy -compat=1.24]': exit status 1, error message: go: github.com/knadh/koanf/[email protected]: Get "https://proxy.golang.org/github.com/knadh/koanf/maps/@v/v0.1.2.mod": crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode
        	Test:       	TestGenerateAndCompile/ConfResolverDefaultURIScheme_set
--- FAIL: TestGenerateAndCompile (1.76s)
    --- FAIL: TestGenerateAndCompile/Default_Configuration_Compilation (0.22s)
    --- FAIL: TestGenerateAndCompile/LDFlags_Compilation (0.22s)
    --- FAIL: TestGenerateAndCompile/GCFlags_Compilation (0.23s)
    --- FAIL: TestGenerateAndCompile/Build_Tags_Compilation (0.21s)
    --- FAIL: TestGenerateAndCompile/Debug_Compilation (0.22s)
    --- FAIL: TestGenerateAndCompile/No_providers (0.22s)
    --- FAIL: TestGenerateAndCompile/With_confmap_factories (0.22s)
    --- FAIL: TestGenerateAndCompile/ConfResolverDefaultURIScheme_set (0.22s)
=== RUN   TestReplaceStatementsAreComplete
2025-10-10T14:25:48.223-0700	INFO	builder/main.go:99	Sources created	{"path": "/var/folders/mc/qr61t2n91z3g63ffq5sy4cm00000gn/T/TestReplaceStatementsAreComplete2507380197/001"}
    main_test.go:420: 
        	Error Trace:	/Users/shaunak/development/github/opentelemetry-collector/cmd/builder/internal/builder/main_test.go:420
        	Error:      	Received unexpected error:
        	            	failed to update go.mod: go subcommand failed with args '[mod tidy -compat=1.24]': exit status 1, error message: go: github.com/knadh/koanf/[email protected]: Get "https://proxy.golang.org/github.com/knadh/koanf/maps/@v/v0.1.2.mod": crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode
        	Test:       	TestReplaceStatementsAreComplete
--- FAIL: TestReplaceStatementsAreComplete (0.22s)
FAIL
FAIL	go.opentelemetry.io/collector/cmd/builder/internal/builder	3.097s
?   	go.opentelemetry.io/collector/cmd/builder/internal/config	[no test files]
FAIL
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.