From a22798b923c814bf13b67609e6b219e23d43313c Mon Sep 17 00:00:00 2001 From: Daniele Isoni Date: Thu, 14 May 2026 10:05:19 +0000 Subject: [PATCH] bugfix: enhance apk add command handling to include --no-network as an alternative to --no-cache --- pkg/assessor/manifest/manifest.go | 2 +- pkg/assessor/manifest/manifest_test.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/assessor/manifest/manifest.go b/pkg/assessor/manifest/manifest.go index 834d316..8dc38ae 100644 --- a/pkg/assessor/manifest/manifest.go +++ b/pkg/assessor/manifest/manifest.go @@ -364,7 +364,7 @@ func reducableAptGetInstall(cmdSlices map[int][]string) bool { func reducableApkAdd(cmdSlices map[int][]string) bool { for _, cmdSlice := range cmdSlices { if containsAll(cmdSlice, []string{"apk", "add"}) { - if !containsAll(cmdSlice, []string{"--no-cache"}) { + if !containsAll(cmdSlice, []string{"--no-cache"}) && !containsAll(cmdSlice, []string{"--no-network"}) { return true } } diff --git a/pkg/assessor/manifest/manifest_test.go b/pkg/assessor/manifest/manifest_test.go index a5c0694..344bc0d 100644 --- a/pkg/assessor/manifest/manifest_test.go +++ b/pkg/assessor/manifest/manifest_test.go @@ -225,6 +225,14 @@ func TestReducableApkAdd(t *testing.T) { }, expected: false, }, + "UnReducableNoNetwork": { + cmdSlices: map[int][]string{ + 0: { + "apk", "add", "--no-network", "git", + }, + }, + expected: false, + }, } for testname, v := range tests { actual := reducableApkAdd(v.cmdSlices)