Repository navigation
fix: close the open code-scanning and dependency findings [#41] - #50
Merged
Merged
Conversation
unzip() joined an attacker-controlled zip entry name straight into the destination path with no bounds check, so a "../" entry could write outside dest (CodeQL go/zipslip).
|
📊 Test Coverage: ✅ Passed — 83% of changed lines covered, min 80% |
🛡️ Trivy security scan (CRITICAL,HIGH,MEDIUM,LOW)Go dependenciesNo findings at CRITICAL,HIGH,MEDIUM,LOW. Container imageNo findings at CRITICAL,HIGH,MEDIUM,LOW. |
nisargabd
force-pushed
the
fix/41-close-code-scanning-alerts
branch
from
September 18, 2026 10:13
4639e33 to
c559309
Compare
CVE-2026-81871 (otlploggrpc v0.19.0, MEDIUM) and CVE-2026-81870 (otlptrace, otlptracegrpc, otel/sdk, LOW) were failing trivy-gate on every PR. Bumps the whole otel release train together -- v1.45.0 for the stable line, v0.21.0 for the log line -- rather than only the four flagged modules, because the two lines are released in lockstep. otel/log v0.21.0 drops its own Value/KeyValue types in favour of the shared go.opentelemetry.io/otel/attribute ones (upstream open-telemetry/opentelemetry-go#8490), so the audit-log call sites move to attribute.String/StringValue/KeyValue. Same keys, same values, same OTLP output -- no behaviour change. A narrower bump is not possible: otlploggrpc v0.21.0 requires otel/log v0.21.0, so module resolution pulls the new API in regardless. stdHandler.go also picks up a gofmt pass: it was already unformatted on development, and the pre-commit hook checks any file the commit touches. Whitespace only, no logic in those lines.
cover-diff grades the whole of every file a PR touches, not just the changed lines, so the security fixes in manager.go and stdHandler.go were being blocked by coverage debt that predates them: 76% and 74% against an 80% floor. Covers what was genuinely untested rather than padding the number. manager.go's CatalogPublisher, CatalogBlobStore, Crawler, Mapper, ProviderStep and SchemaVersionMediator were all at 0% despite being the same provider-lookup shape as Publisher and Cache next to them; each now has the success, provider-error and plugin-missing cases the neighbouring accessors already had. stdHandler.go's LoadKeyManager, loadManifestLoader, loadPayloadStore, LoadPolicyChecker and loadPayloadTransformerStep get their argument-validation branches covered, including the registry that satisfies RegistryLookup but not RegistryMetadataLookup. manager.go 76% -> 90%, stdHandler.go 74% -> 81%, changed-file total 75% -> 86%. Test files only; no production code touched.
nisargabd
force-pushed
the
fix/41-close-code-scanning-alerts
branch
from
September 18, 2026 10:24
c559309 to
1a815d9
Compare
Member
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
manjudr
approved these changes
Sep 18, 2026
This was referenced Oct 30, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
1. Zip slip —
pkg/plugin/manager.go(CodeQLgo/zipslip, HIGH)unzip()joined an attacker-controlled zip entry name into the destination path with no bounds check, so an entry like../../etc/xcould write outside the extraction directory. Now rejected. Ships with a regression test that was verified to fail without the guard.2. otel dependency CVEs —
go.mod(Trivy, MEDIUM + LOW)CVE-2026-81871(otlplog/otlploggrpcv0.19.0) andCVE-2026-81870(otlptrace,otlptracegrpc,otel/sdk). Bumps the whole otel release train together — v1.45.0 stable, v0.21.0 log — rather than only the four flagged modules, because the two lines release in lockstep.This forces a code change in
pkg/telemetry/audit.goandcore/module/handler/stdHandler.go: otel/log v0.21.0 removes its ownValue/KeyValuetypes in favour of the sharedgo.opentelemetry.io/otel/attributeones (opentelemetry-go PR 8490). Same keys, same values, same OTLP output — no behaviour change. A narrower bump isn't possible;otlploggrpc@v0.21.0requiresotel/log@v0.21.0, so module resolution pulls the new API in regardless.Worth noting this is not theoretical cleanup: scanning the currently published
ghcr.io/openagrinet/network-adapter:0.0.1against today's vulnerability database still reportsCVE-2026-81870in the shipped binary. An image built from this branch reports zero.3. Coverage — test files only
cover-diffgrades the whole of every file a PR touches, not just the changed lines, so these fixes were blocked by coverage debt predating them. Covers what was genuinely untested:manager.go'sCatalogPublisher,CatalogBlobStore,Crawler,Mapper,ProviderStepandSchemaVersionMediatorwere all at 0%, andstdHandler.go's plugin-loader argument validation was thinly covered.Why
Closes the findings tracked in #41. Two items in that issue are deliberately not fixed in code, with reasoning:
go/incorrect-integer-conversionx2 (catalogcrawler.go:153,158) — dismissed as false positive. CodeQL flagsint64→intnarrowing without knowing the target architecture. This repo only ships amd64/arm64, where Go'sintis 64 bits — identical width toint64, so the conversion cannot narrow or wrap. A guard against it would be a branch that can never execute, which is dead code and permanently uncoverable. Full reasoning is recorded on the dismissed alerts themselves: code-scanning alert 48 and alert 49.CVE-2026-85091(zlib, container image) — awolfi-basebase-image issue, not application code. Confirmed already absent from a freshwolfi-base:latestpull, so no change or ignore-file is needed.Testing
gofmt,go vetclean on every touched package.go testacross all packages, plus the pre-push hook's full run.trivy fs .on the bumpedgo.mod: 0 vulnerabilities, down from 4.trivy imageon an image built from this branch: 0 vulnerabilities, base layer and Go binary both clean.govulncheck ./...: 0 reachable vulnerabilities.make cover-difflocally: 86% of changed lines covered, min 80% (was 75%).manager.go76%→90%,stdHandler.go74%→81%.WithEndpointURLpath handling (HTTP exporters only — this repo uses gRPC exclusively and never calls it) and the sdk/metric cardinality limit (already active, repo was already on sdk/metric v1.44.0). Neither applies.One incidental change:
stdHandler.gopicks up agofmtpass. It was already unformatted ondevelopmentand the pre-commit hook checks any file a commit touches — whitespace only, no logic in those lines.Closes #41