Skip to content

Commit d10daea

Browse files
authored
sca: fix SCA for go-fips-1.25 (#2153)
Ensure that Melange SCA generates depends for packages that use the new go-msft-1.25 toolchain. Tried to create a test case for this, but failed in: - #2152 It would require enterprise-packages access which is not great. Separately test cases are available as, currently: - 1.24 works chainguard-dev/enterprise-packages#33090 - 1.25 doesn't chainguard-dev/enterprise-packages#33091 And with this PR both should start working again. Suggestions on how to make test cases work are welcomed to catch this. My plan is to add SCA check to go-msft packages themselves, such that it breaks when there are changes to build-info in the future: - chainguard-dev/enterprise-packages#32952 Also note that libssl.so is unused, and only libcrypto is dlopened.
1 parent 54a57bc commit d10daea

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pkg/sca/e2e_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ func TestGoFipsBinDeps(t *testing.T) {
4040
"so:ld-linux-x86-64.so.2",
4141
"so:libc.so.6",
4242
"so:libcrypto.so.3",
43-
"so:libssl.so.3",
4443
},
4544
Provides: []string{"cmd:go-fips-bin=0.0.1-r0"},
4645
}

pkg/sca/sca.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func isHostProvidedLibrary(lib string) bool {
132132
"libnvidia-tls.so.1",
133133
"libnvoptix.so.1",
134134
}
135-
135+
136136
for _, hostLib := range hostLibs {
137137
if lib == hostLib {
138138
return true
@@ -702,12 +702,14 @@ func generateSharedObjectNameDeps(ctx context.Context, hdl SCAHandle, generated
702702
if setting.Key == "GOEXPERIMENT" && slices.Contains(fipsexperiments, setting.Value) {
703703
fipscrypto = true
704704
}
705+
if setting.Key == "microsoft_systemcrypto" && setting.Value == "1" {
706+
fipscrypto = true
707+
}
705708
}
706709
// strong indication of go-fips openssl compiled binary, will dlopen the below at runtime
707710
if cgo && fipscrypto {
708711
generated.Runtime = append(generated.Runtime, "openssl-config-fipshardened")
709712
generated.Runtime = append(generated.Runtime, "so:libcrypto.so.3")
710-
generated.Runtime = append(generated.Runtime, "so:libssl.so.3")
711713
}
712714

713715
return nil

0 commit comments

Comments
 (0)