From 0a7026a1bb7826328771fa8d04ee2b038bdfa45b Mon Sep 17 00:00:00 2001 From: Ahmed ElMallah Date: Sat, 24 Oct 2026 16:41:41 -0700 Subject: [PATCH 1/3] test(cli): stop the diff audit test failing on a newly published advisory TestRoot_DiffCommand_AuditUsesResolvedGitRefs runs the live grype and osv matchers against real npm packages and required the run to exit cleanly, which held only while none of them carried a high advisory. GHSA-mrhx-c7xc-m3w5 (CVE-2023-54404) now matches zod 3.23.0, the default threshold fails the run, and the test fails on main. The test is about the git refs the audit resolves, not the advisory set. Accept a policy-violation exit, but only when the audit payload holds a failing introduced or persisted finding to justify it; any other error, or a policy exit with nothing behind it, still fails. Co-Authored-By: Claude Opus 5.5 --- internal/cli/root_cmd_test.go | 39 ++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/internal/cli/root_cmd_test.go b/internal/cli/root_cmd_test.go index b8aa2bd2..f5ab34e9 100644 --- a/internal/cli/root_cmd_test.go +++ b/internal/cli/root_cmd_test.go @@ -16,6 +16,7 @@ import ( "github.com/bomly-dev/bomly-cli/internal/cli/exit" "github.com/bomly-dev/bomly-cli/internal/cli/render" syftdetector "github.com/bomly-dev/bomly-plugin-syft-detector/plugin" + "github.com/bomly-dev/bomly-sdk/model" "github.com/bomly-dev/bomly-sdk/system" "github.com/spf13/cobra" ) @@ -999,17 +1000,28 @@ func TestRoot_DiffCommand_AuditUsesResolvedGitRefs(t *testing.T) { "-o", "sarif=" + sarifPath, }) - if err := root.Execute(); err != nil { - t.Fatalf("root.Execute() error = %v; stderr=%s", err, stderr.String()) + // The matchers are live, so whether these real packages carry a failing + // advisory changes as advisories are published: zod 3.23.0 gained + // GHSA-mrhx-c7xc-m3w5 after this test was written. This test is about the + // refs the audit resolves, not the advisory set, so a policy-violation exit + // is accepted -- but only when the audit holds a failing finding to justify + // it. Any other error still fails. + execErr := root.Execute() + if execErr != nil && exit.Code(execErr) != exitCodePolicyViolation { + t.Fatalf("root.Execute() error = %v; stderr=%s", execErr, stderr.String()) } var payload map[string]any if err := json.Unmarshal(stdout.Bytes(), &payload); err != nil { t.Fatalf("unmarshal output: %v\n%s", err, stdout.String()) } - if payload["audit"] == nil { + audit, ok := payload["audit"].(map[string]any) + if !ok { t.Fatalf("expected audit payload, got %#v", payload) } + if failing := diffAuditFailingCount(audit); (execErr != nil) != (failing > 0) { + t.Fatalf("exit error = %v with %d failing audit findings; a policy-violation exit must match a failing finding", execErr, failing) + } summary, ok := payload["summary"].(map[string]any) if !ok { t.Fatalf("expected summary object, got %#v", payload["summary"]) @@ -1026,6 +1038,27 @@ func TestRoot_DiffCommand_AuditUsesResolvedGitRefs(t *testing.T) { } } +// exitCodePolicyViolation is the exit code a run returns when a finding meets +// the configured --fail-on threshold. +const exitCodePolicyViolation = 2 + +// diffAuditFailingCount counts the introduced and persisted findings of a +// diff's audit payload whose policy status fails the run -- the same findings +// diffPolicyExit counts. +func diffAuditFailingCount(audit map[string]any) int { + failing := 0 + for _, key := range []string{"introduced", "persisted"} { + findings, _ := audit[key].([]any) + for _, raw := range findings { + finding, _ := raw.(map[string]any) + if status, _ := finding["policy_status"].(string); status == "" || status == string(model.FindingPolicyStatusFail) { + failing++ + } + } + } + return failing +} + func TestRoot_ScanCommand_QuietSuppressesVerboseLogs(t *testing.T) { tempHome := t.TempDir() t.Setenv("HOME", tempHome) From 648fbd59a9f7f627c456cf5f812839ed4676471c Mon Sep 17 00:00:00 2001 From: Ahmed ElMallah Date: Sat, 24 Oct 2026 16:41:45 -0700 Subject: [PATCH 2/3] build(lint): bump golangci-lint to v2.15.0 v2.13.2 cannot type-check packages built by Go 1.27.2 ("export data version 5 is greater than maximum supported version 4"), so make lint and the pre-commit hook fail on every package for anyone on the current Go patch release. CI stayed green only because setup-go installs the go.mod floor, 1.27.0. v2.15.0 carries golang.org/x/tools 0.52.0 and lints the tree clean, default and lite build tags, from an empty cache. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 4 ++-- Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 22da5eaa..661f9dfd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,13 +29,13 @@ jobs: - name: Run golangci-lint uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 with: - version: v2.13.2 + version: v2.15.0 # composition_lite.go is behind the lite build tags, which the run above # does not see; the house rules in .golangci.yml must cover it too. - name: Run golangci-lint under the lite build tags uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 with: - version: v2.13.2 + version: v2.15.0 args: --build-tags=bomly_external_syft,bomly_external_grype ./internal/composition/... skip-cache: true # The structural house rules (internal/tools/guardcheck) run as a vet diff --git a/Makefile b/Makefile index 276a6a53..717e6ab3 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ BINARY_NAME=bomly LITE_BUILD_TAGS=bomly_external_syft,bomly_external_grype -GOLANGCI_LINT_VERSION=v2.13.2 +GOLANGCI_LINT_VERSION=v2.15.0 GO_LICENSES_VERSION=v1.6.0 GOPATH_BIN=$(shell go env GOPATH)/bin EXE_SUFFIX=$(if $(filter Windows_NT,$(OS)),.exe,) From cb6a7e1abf1fdb59749c32931f639268828f0960 Mon Sep 17 00:00:00 2001 From: Ahmed ElMallah Date: Sat, 24 Oct 2026 16:41:56 -0700 Subject: [PATCH 3/3] build(deps): bump bomly-plugin-jvmreach-analyzer to v0.4.1 v0.4.1 discovers a Maven or Gradle module in a directory whose name begins with two dots, such as the "..data" of a Kubernetes Secret or ConfigMap mount, which v0.4.0 silently skipped (bomly-dev/bomly-plugin-jvmreach-analyzer#3). Co-Authored-By: Claude Opus 5.5 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index ca6b2a0d..1cf8e892 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/bomly-dev/bomly-plugin-govulncheck-analyzer v0.4.0 github.com/bomly-dev/bomly-plugin-grype-matcher v0.7.0 github.com/bomly-dev/bomly-plugin-jsreach-analyzer v0.4.0 - github.com/bomly-dev/bomly-plugin-jvmreach-analyzer v0.4.0 + github.com/bomly-dev/bomly-plugin-jvmreach-analyzer v0.4.1 github.com/bomly-dev/bomly-plugin-osv-matcher v0.3.0 github.com/bomly-dev/bomly-plugin-pyreach-analyzer v0.4.0 github.com/bomly-dev/bomly-plugin-scorecard-matcher v0.3.0 diff --git a/go.sum b/go.sum index 8fb40313..a639fad6 100644 --- a/go.sum +++ b/go.sum @@ -253,8 +253,8 @@ github.com/bomly-dev/bomly-plugin-grype-matcher v0.7.0 h1:mp3ekZYtLWMfulmzPAWnTr github.com/bomly-dev/bomly-plugin-grype-matcher v0.7.0/go.mod h1:UD+Run063WieY49dM5iLYm24Krwy/AwvKUoAfLrusWY= github.com/bomly-dev/bomly-plugin-jsreach-analyzer v0.4.0 h1:3Fz4E0LLKUqFouQezqL5Te87H9dpo0dB3Qbl/uOqGiQ= github.com/bomly-dev/bomly-plugin-jsreach-analyzer v0.4.0/go.mod h1:x4r4Jw6MsWursNS0Gk/6JFjs7/EoFaXJD15j0DsVxvM= -github.com/bomly-dev/bomly-plugin-jvmreach-analyzer v0.4.0 h1:Lc6sI8bxVpSKluUyJogzsumlYtRZ41usNuIZ8UJCrv8= -github.com/bomly-dev/bomly-plugin-jvmreach-analyzer v0.4.0/go.mod h1:cWpKV6mblMGEe7c6jQZZ+dqJhEVhZ8ci1k5GULSaiss= +github.com/bomly-dev/bomly-plugin-jvmreach-analyzer v0.4.1 h1:ZLfQn2qABnGQj7zofaZ7Nd0KOKVCFY3EDFadv3+gwCc= +github.com/bomly-dev/bomly-plugin-jvmreach-analyzer v0.4.1/go.mod h1:0UkkLRHhXDgr6+9IwaQtSBCatpC3p5ddF6KHdYUWxNE= github.com/bomly-dev/bomly-plugin-osv-matcher v0.3.0 h1:OU0cHFxsoUZczUv9fEbOQM6A10awY1VOlmeIlTgDQhY= github.com/bomly-dev/bomly-plugin-osv-matcher v0.3.0/go.mod h1:psK1ra4DLJn2c+txMUhnTCVujZQTQ1N0LdhSsjcyKik= github.com/bomly-dev/bomly-plugin-pyreach-analyzer v0.4.0 h1:lljvmXB+zTgXw6S0eDIK1zZaPkKcsp+njD3IdorZLBU=