Skip to content

AST-165915: keep the platform fix without the cloud SDK dependencies - #55

Open
cx-dmitri-rivin wants to merge 1 commit into
mainfrom
AST-165915-bug-new-way
Open

cx-dmitri-rivin wants to merge 1 commit into
mainfrom
AST-165915-bug-new-way

Conversation

@cx-dmitri-rivin

Copy link
Copy Markdown
Contributor

Why

The AST-165915 fix (#53) is correct, but it shipped alongside an unrelated dependabot bump of syft (v1.21.0 -> v1.42.4) and stereoscope (v0.1.0 -> v0.1.22).

The newer syft imports hashicorp/go-getter, whose package-level Getters map unconditionally registers the GCS and S3 backends. That drags the whole aws-sdk-go-v2 and cloud.google.com/go/* trees into the graph even though nothing in this module (or in the CLI) ever fetches from S3 or GCS. Reviewers on the ast-cli bump measured the CLI binary growing 81MB -> 113MB for dependencies the CLI never calls.

containers-syft-packages-extractor v1.0.27 already re-pinned syft/stereoscope back to their pre-bump versions, but this module's go.mod still carried the upgraded requirements from its own tidy, so the cloud SDKs stayed in the graph and the CLI-side bump did not shrink. This PR re-tidies against v1.0.27.

What changed

go.mod / go.sum only — no source changes.

go.mod is now byte-identical to the pre-fix state except for the one line that matters:

-	github.com/Checkmarx/containers-syft-packages-extractor v1.0.25
+	github.com/Checkmarx/containers-syft-packages-extractor v1.0.27
before after
cloud.google.com/*, GoogleCloudPlatform/*, aws-sdk-go-v2/*, smithy-go entries 30 0
anchore/syft v1.42.4 v1.21.0
anchore/stereoscope v0.1.22 v0.1.0
go directive 1.25.8 1.24.1

The fix itself is unchanged

Resolve still calls AnalyzeImages rather than AnalyzeImagesWithPlatform("linux/amd64"), so each image is resolved on the platform it was actually built for. The extractor-side fix (resolvePlatform returning nil for "no preference", and the mismatched platform / no child with platform error mapping) is present in v1.0.27 and needs no syft or stereoscope API newer than v1.21.0.

Verification

  • go build ./..., go vet ./... clean
  • go test ./... -count=1 — all pass
  • Built the CLI locally against this branch vs. current ast-cli main:
build size
ast-cli main (resolver v1.0.34, pre-fix) 114,123,874 B
ast-cli + this branch (fix included) 114,141,890 B

+18 KB, i.e. the platform fix costs nothing. For comparison, ast-cli against resolver v1.0.36 pulls in 30 cloud SDK modules and does not even compile (containerd/v2 API conflict).

Next step

Once this is tagged, ast-cli is bumped to the new version — a one-line change in its go.mod with no new dependencies.

🤖 Generated with Claude Code

…rm fix

The platform-mismatch fix shipped alongside an unrelated dependabot bump of
syft (v1.21.0 -> v1.42.4) and stereoscope (v0.1.0 -> v0.1.22). The newer syft
imports hashicorp/go-getter, whose package-level Getters map unconditionally
registers the GCS and S3 backends, so the whole aws-sdk-go-v2 and
cloud.google.com/go/* trees became transitive dependencies even though nothing
here fetches from S3 or GCS. Reviewers on ast-cli measured the resulting binary
growing from 81MB to 113MB for dependencies the CLI never calls.

containers-syft-packages-extractor v1.0.27 already re-pinned syft/stereoscope to
their pre-bump versions, but this module's go.mod still carried the upgraded
requirements from its own tidy, so the cloud SDKs stayed in the graph. Re-tidying
against v1.0.27 removes them: go.mod and go.sum are now identical to the
pre-fix state apart from the extractor version itself.

The fix's behaviour is unchanged - Resolve still calls AnalyzeImages so that each
image resolves on the platform it was built for - and it needs no syft or
stereoscope API newer than v1.21.0.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@cx-dmitri-rivin

Copy link
Copy Markdown
Contributor Author

End-to-end repro on the pinned (v1.21.0) syft

Confirming the fix still reproduces and resolves with the old syft/stereoscope, i.e. the dependency bump was never needed for it.

Built a single-architecture local image on an arm64 host:

docker build --platform linux/arm64 -t ast165915-local:arm64 .
# linux/arm64

Then ran the extractor from this branch's dependency set (syft v1.21.0, stereoscope v0.1.0) both ways:

=== OLD behaviour: forced linux/amd64 ===
  image=ast165915-local status="Failed" packages=0
  failure reason: Access to the image is restricted. Verify the repository permissions and credentials. Registry: index.docker.io

=== NEW behaviour: no platform forced ===
  image=ast165915-local status="Resolved" packages=14

Two things this shows:

  1. The bug is exactly the forced linux/amd64 — with no platform forced the image resolves and yields its 14 packages.
  2. The old code also reported the wrong cause. stereoscope aggregates every provider's failure, so the platform mismatch against the daemon arrived bundled with the registry fallback's auth errors, and the mapper matched unauthorized first — surfacing "Access to the image is restricted" for what is actually an architecture mismatch. The mismatched platform / no child with platform check in v1.0.27 now takes precedence over the auth patterns.

Neither part needs an API newer than syft v1.21.0.

@cx-shaked-karta

Copy link
Copy Markdown
Contributor

Logo
Checkmarx One – Scan Summary & Detailsd3787c4f-0818-419c-99f7-a268b0410910


New Issues (11)

Critical: 1 · High: 5 · Medium: 4 · Low: 1

Checkmarx found the following issues in this Pull Request

# Severity Issue Source File / Package Checkmarx Insight
1 CRITICAL CVE-2026-33186 Go-google.golang.org/grpc-v1.72.2
detailsRecommended version: v1.72.4-0.20250910101011-fd43e6949339
Description: In versions prior to 1.79.3, gRPC-Go contains an authorisation bypass caused by improper input validation of the HTTP/2: path pseudo-header. The se...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
2 HIGH CVE-2024-25621 Go-github.com/containerd/containerd/v2-v2.1.2
detailsRecommended version: v2.1.5
Description: Containerd is an open-source container runtime. Versions from 0.1.0 through 1.7.28, 2.0.x through 2.0.6, 2.1.x through 2.1.4 and 2.2.x through 2.2....
Attack Vector: LOCAL
Attack Complexity: LOW
Vulnerable Package
3 HIGH CVE-2026-24051 Go-go.opentelemetry.io/otel/sdk-v1.36.0
detailsRecommended version: v1.37.1-0.20250716203334-5e212ba8c6a7
Description: OpenTelemetry-Go is the Go implementation of OpenTelemetry. The OpenTelemetry Go SDK versions from 1.20.0 through 1.39.0 is vulnerable to Path Hija...
Attack Vector: LOCAL
Attack Complexity: HIGH
Vulnerable Package
4 HIGH CVE-2026-56855 Go-golang.org/x/crypto-v0.45.0
detailsRecommended version: v0.55.1-0.20260902180247-86efde54dc70
Description: Previously, after a channel has been established, a malicious peer could send crafted messages that would deadlock the entire connection. Now, we h...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
5 HIGH CVE-2026-78662 Go-golang.org/x/crypto-v0.45.0
detailsRecommended version: v0.55.1-0.20260902180247-86efde54dc70
Description: Previously, a channel registered in the mux's chanList is not usable until it is established. A malicious peer was able flood the channel's incomin...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
6 HIGH CVE-2026-84445 Go-google.golang.org/grpc-v1.72.2
detailsRecommended version: v1.82.0
Description: A vulnerability exists in gRPC-Go servers configured with `xds.NewGRPCServer()` where a crafted request missing both `:authority` and `Host` header...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
7 MEDIUM CVE-2025-64329 Go-github.com/containerd/containerd/v2-v2.1.2
detailsRecommended version: v2.1.5
Description: Containerd is an open-source container runtime. Versions through 1.7.28, 2.0.0-beta.0 through 2.0.6, 2.1.0-beta.0 through 2.1.4, and 2.2.0-beta.0 t...
Attack Vector: LOCAL
Attack Complexity: LOW
Vulnerable Package
8 MEDIUM CVE-2026-24137 Go-github.com/sigstore/sigstore-v1.8.15
detailsRecommended version: v1.10.4
Description: sigstore framework is a common go library shared across sigstore services and clients. In versions through 1.10.3 the legacy TUF client (pkg/tuf/c...
Attack Vector: NETWORK
Attack Complexity: HIGH
Vulnerable Package
9 MEDIUM CVE-2026-25934 Go-github.com/go-git/go-git/v5-v5.14.0
detailsRecommended version: v5.16.5
Description: go-git is a highly extensible git implementation library written in pure Go. Prior to 5.16.5, a vulnerability was discovered in go-git whereby data...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
10 MEDIUM CVE-2026-33481 Go-github.com/anchore/syft-v1.21.0
detailsRecommended version: v1.23.1-0.20250424215945-03fa142de99e
Description: Syft is a a CLI tool and Go library for generating a Software Bill of Materials (SBOM) from container images and filesystems. Syft versions before ...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
11 LOW CVE-2026-1229 Go-github.com/cloudflare/circl-v1.6.1
detailsRecommended version: v1.6.3
Description: The "CombinedMult()" function in the CIRCL ecc/p384 package (secp384r1 curve) produces an incorrect value for specific inputs. The issue is fixed b...
Attack Vector: NETWORK
Attack Complexity: HIGH
Vulnerable Package

Fixed Issues (6)

High: 5 · Medium: 1

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
HIGH CVE-2026-33813 Go-golang.org/x/image-v0.25.0
HIGH CVE-2026-46599 Go-golang.org/x/image-v0.25.0
HIGH CVE-2026-4660 Go-github.com/hashicorp/go-getter-v1.8.5
HIGH CVE-2026-46602 Go-golang.org/x/image-v0.25.0
HIGH CVE-2026-46604 Go-golang.org/x/image-v0.25.0
MEDIUM CVE-2026-33809 Go-golang.org/x/image-v0.25.0

Use @Checkmarx to interact with Checkmarx PR Assistant.
Examples:
@Checkmarx how are you able to help me?
@Checkmarx rescan this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants