Skip to content

Commit a9cbb33

Browse files
committed
Fix remaining scanner findings
1 parent 8a6e283 commit a9cbb33

6 files changed

Lines changed: 73 additions & 14 deletions

File tree

.agents/sow/done/SOW-0010-20260602-static-analysis-finding-cleanup.md

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
Status: completed
66

7-
Sub-state: Reopened after GitHub Static Analysis exposed staticcheck
8-
annotations from the previous commit; fixed and locally validated.
7+
Sub-state: Codacy Cloud remaining findings were fixed locally and scanner
8+
validation passed.
99

1010
## Requirements
1111

@@ -414,3 +414,60 @@ Artifact updates:
414414
overflow behavior and makes it explicit.
415415
- Runtime project skills: no update needed.
416416
- End-user/operator docs and skills: no public workflow changed.
417+
418+
## Regression - 2026-06-02 Codacy Cloud Remaining Findings
419+
420+
What broke:
421+
422+
- Codacy Cloud showed 70 remaining issues after the scanner cleanup commits:
423+
68 Trivy Go standard-library vulnerability findings at `src/go/go.mod:3`
424+
and `tests/fixtures/go/go.mod:3`, one ShellCheck `SC2015` finding at
425+
`tests/run-verifier-windows.sh:196`, and one Semgrep file-permission finding
426+
at `tests/fixtures/go/cmd/interop_codec/main.go:22`.
427+
- GitHub Code Scanning still showed 7,199 open alerts. All but one were stale
428+
alerts from removed or tuned producers: markdownlint, Flawfinder, broad
429+
Semgrep, lizard, revive, Agentlinter, and Scorecard. The one live
430+
result-bearing rule class was ShellCheck `SC2015`.
431+
432+
Why previous validation missed it:
433+
434+
- Local Codacy analysis produced zero findings, but Codacy Cloud also reported
435+
Trivy findings against Go standard-library patch levels from `go.mod` files.
436+
- The previous GitHub validation focused on the new commit's successful
437+
workflows and did not yet reconcile Codacy Cloud's issue list after
438+
reanalysis.
439+
440+
Repair plan:
441+
442+
- Update all Go module declarations from the vulnerable `go 1.25` language
443+
version to the patched `go 1.25.10` patch release, preserving the same Go
444+
language family.
445+
- Replace the ambiguous ShellCheck `SC2015` expression with explicit shell
446+
control flow.
447+
- Change the Go interop fixture output file mode from world-readable `0644` to
448+
owner-only `0600`.
449+
- Re-run local Go tests, ShellCheck, Trivy, staticcheck, Codacy local analysis,
450+
SOW audit, and post-push GitHub/Codacy remote checks.
451+
452+
Validation:
453+
454+
- `cd src/go && go test ./...` passed.
455+
- `cd tests/fixtures/go && go test ./...` passed.
456+
- `cd bench/drivers/go && go test ./...` passed.
457+
- `shellcheck tests/run-verifier-windows.sh` passed after fixing `SC2015`,
458+
`SC2059`, and `SC2034` findings in that script.
459+
- `trivy fs --scanners vuln --format json --output /tmp/plugin-ipc-trivy-after.json .`
460+
passed with zero vulnerabilities after updating Go module patch levels.
461+
- `cd src/go && "$(go env GOPATH)/bin/staticcheck" ./...` passed.
462+
- `cd tests/fixtures/go && "$(go env GOPATH)/bin/staticcheck" ./...` passed.
463+
- `cd bench/drivers/go && "$(go env GOPATH)/bin/staticcheck" ./...` passed.
464+
- `codacy-analysis analyze . --output-format sarif --output /tmp/plugin-ipc-codacy-after-cloud-fixes.sarif --parallel-tools 2 --tool-timeout 900000`
465+
reported zero issues across Checkov, cppcheck, Opengrep, Revive,
466+
ShellCheck, Spectral, and Trivy. The CLI logged the same 15 non-fatal tool
467+
errors as earlier: 14 Semgrep and 1 Revive parser/runtime errors.
468+
469+
Artifact updates:
470+
471+
- Specs: no protocol/API behavior changes are planned.
472+
- Runtime project skills: no project runtime skill update is expected.
473+
- End-user/operator docs and skills: no public SDK workflow change is expected.

bench/drivers/go/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/netdata/plugin-ipc/bench/drivers/go
22

3-
go 1.25
3+
go 1.25.10
44

55
require github.com/netdata/plugin-ipc/go v0.0.0
66

src/go/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module github.com/netdata/plugin-ipc/go
22

3-
go 1.25
3+
go 1.25.10

tests/fixtures/go/cmd/interop_codec/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919

2020
func writeFile(dir, name string, data []byte) {
2121
path := filepath.Join(dir, name)
22-
if err := os.WriteFile(path, data, 0644); err != nil {
22+
if err := os.WriteFile(path, data, 0600); err != nil {
2323
fmt.Fprintf(os.Stderr, "ERROR: cannot write %s: %v\n", path, err)
2424
os.Exit(1)
2525
}

tests/fixtures/go/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/netdata/plugin-ipc/tests/fixtures/go
22

3-
go 1.25
3+
go 1.25.10
44

55
require github.com/netdata/plugin-ipc/go v0.0.0
66

tests/run-verifier-windows.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ if [[ ${#TARGETS[@]} -eq 0 ]]; then
3131
fi
3232

3333
run() {
34-
printf >&2 "${GRAY}$(pwd) >${NC} "
35-
printf >&2 "${YELLOW}"
34+
printf >&2 "%b%s >%b " "$GRAY" "$(pwd)" "$NC"
35+
printf >&2 "%b" "$YELLOW"
3636
printf >&2 "%q " "$@"
37-
printf >&2 "${NC}\n"
37+
printf >&2 "%b\n" "$NC"
3838
if "$@"; then
3939
return 0
4040
else
@@ -164,17 +164,17 @@ for target in "${TARGETS[@]}"; do
164164
run "$APPVERIF_BIN" -enable "${VERIFIER_LAYER_ARGS[@]}" -for "$target"
165165
run env MSYS2_ARG_CONV_EXCL='*' "$GFLAGS_BIN" /p /enable "$target" /full
166166

167-
printf >&2 "${GRAY}$(pwd) >${NC} "
168-
printf >&2 "${YELLOW}"
167+
printf >&2 "%b%s >%b " "$GRAY" "$(pwd)" "$NC"
168+
printf >&2 "%b" "$YELLOW"
169169
printf >&2 "%q %q %q " timeout "$TIMEOUT_SECONDS" "$exe_path"
170-
printf >&2 "${NC}\n"
170+
printf >&2 "%b\n" "$NC"
171171
set +e
172172
timeout "$TIMEOUT_SECONDS" "$exe_path" >"$stdout_log" 2>"$stderr_log"
173173
exit_code=$?
174174
set -e
175175

176176
verifier_result=0
177-
verifier_output=$(export_log "$target" "$xml_out") || verifier_result=$?
177+
export_log "$target" "$xml_out" >/dev/null || verifier_result=$?
178178

179179
if [[ $verifier_result -eq 2 ]]; then
180180
verifier_clean=true
@@ -193,7 +193,9 @@ for target in "${TARGETS[@]}"; do
193193

194194
if ! $verifier_clean; then
195195
echo -e "${RED}Verifier findings recorded for:${NC} $target"
196-
[[ -f "$xml_out" ]] && sed -n '1,120p' "$xml_out" || true
196+
if [[ -f "$xml_out" ]]; then
197+
sed -n '1,120p' "$xml_out" || true
198+
fi
197199
all_pass=false
198200
else
199201
echo -e "${GREEN}No verifier findings for:${NC} $target"

0 commit comments

Comments
 (0)