Skip to content

Comments

feat: upgrade AWS SDK and switch to AWS native basic scanning#33

Merged
Andrey9kin merged 3 commits intomasterfrom
feat/aws-native-scanning-sdk-upgrade
Feb 12, 2026
Merged

feat: upgrade AWS SDK and switch to AWS native basic scanning#33
Andrey9kin merged 3 commits intomasterfrom
feat/aws-native-scanning-sdk-upgrade

Conversation

@Andrey9kin
Copy link
Member

@Andrey9kin Andrey9kin commented Feb 12, 2026

Summary

Migrate from deprecated Clair-based ECR scanning to AWS native basic scanning (default since Feb 2, 2026). Upgrade AWS SDK Go v2 and all cascading dependencies to current versions.

Changes

Core

  • Upgrade AWS SDK Go v2 (v1.16.7 -> v1.41.1, ECR service v1.17.8 -> v1.55.1)
  • Upgrade Go from 1.14 to 1.24
  • Add retry logic for ScanNotFoundException to handle scan initiation delay with AWS native scanning
  • Add pagination for DescribeImageScanFindings to collect all findings across pages
  • Handle both Clair UnsupportedImageError and AWS native ScanNotFoundException for unscannable images

Dependencies (cascading from Go/SDK bump)

  • Docker client library v20.10.17 -> v28.5.2 (AuthConfig, PushOptions moved to sub-packages)
  • distribution/reference extracted to github.com/distribution/reference
  • urfave/cli v2.10.3 -> v2.27.7
  • tablewriter v0.0.5 -> v1.1.3 (new API)

CI and Tooling

  • GitHub Actions: checkout v4, setup-go v5, goreleaser v6, golangci-lint v6, codeql v3
  • golangci-lint v1.46.2 -> v2.9.0, fix errcheck findings
  • goreleaser --rm-dist -> --clean
  • Workflows trigger on both master and main branches

Tests

  • Replace deprecated resin/scratch with locally built scratch image
  • Switch from old Alpine to python:3.13 (Debian-based) for CVE tests
  • Fix negative tests to properly exit 1 on unexpected pass

Testing

  • Built binary and ran full integration test suite against real ECR (aws-vault exec)
  • All 5 test cases pass: scratch image, image with ignored CVEs, repo with slash, expected failure without ignores, expected failure with duplicated ignores
  • Linter passes clean (golangci-lint v2.9.0, 0 issues)
  • go vet passes clean

Checklist

  • Tests pass (integration tests against real ECR)
  • Linter passes (golangci-lint v2.9.0)
  • go vet passes
  • CHANGELOG updated (v0.7.0)
  • README updated (version refs, new features, examples)

Made with Cursor


Note

Medium Risk
Changes core ECR scan waiting/handling behavior and bumps major dependencies (AWS SDK, Docker client, Go), which could alter scan outcomes or push/scan interactions despite being straightforward.

Overview
Migrates scan-result collection to work reliably with AWS native basic scanning by retrying the scan waiter on ScanNotFoundException, treating persistent scan absence as an unsupported-image finding, and paginating DescribeImageScanFindings to return complete results.

Modernizes the project by upgrading to Go 1.24, updating the AWS SDK v2/ECR client and Docker client APIs, and adjusting output/error-handling patterns (e.g., close/append/render errcheck fixes and newer tablewriter/distribution/reference usage).

Updates automation and docs: GitHub Actions now run on master and main, bump action versions (checkout/setup-go/goreleaser/golangci-lint/codeql), refresh the linter image, update integration tests to use python:3.13 and a locally built scratch image, and bump documentation/changelog to v0.7.0.

Written by Cursor Bugbot for commit 622e992. This will update automatically on new commits. Configure here.

Andrey9kin and others added 2 commits February 12, 2026 12:44
Migrate from deprecated Clair-based ECR scanning to AWS native basic
scanning, which became the default after Clair deprecation on Feb 2, 2026.

Core changes:
- Upgrade AWS SDK Go v2 (v1.16.7 -> v1.41.1, ECR service v1.17.8 -> v1.55.1)
- Upgrade Go from 1.14 to 1.24
- Add retry logic for ScanNotFoundException to handle scan initiation
  delay with AWS native scanning (up to 5 min with 15s intervals)
- Add pagination for DescribeImageScanFindings to collect all findings
- Handle both Clair UnsupportedImageError and AWS native ScanNotFoundException
  for unscannable images (e.g. scratch)

Dependency upgrades (cascading from Go/SDK bump):
- Docker client library v20.10.17 -> v28.5.2 (new type import paths)
- distribution/reference extracted to github.com/distribution/reference
- urfave/cli v2.10.3 -> v2.27.7
- tablewriter v0.0.5 -> v1.1.3 (new API: Header, Append, Render)

CI and tooling:
- GitHub Actions: checkout v4, setup-go v5, goreleaser v6, golangci-lint v6, codeql v3
- golangci-lint v1.46.2 -> v2.9.0, fix errcheck findings
- goreleaser --rm-dist -> --clean (renamed flag)
- Workflows trigger on both master and main branches

Test suite:
- Replace deprecated resin/scratch with locally built scratch image
- Switch from old Alpine to python:3.13 (Debian-based) for CVE tests
- Fix negative tests to properly exit 1 on unexpected pass

Co-authored-by: Cursor <cursoragent@cursor.com>
- docker.go: simplify imageTag to direct return, remove redundant else
  after return in getImageIdFromDockerDaemonJsonMessages
- ecr.go: use slices.Contains in IsFindingIgnored and
  AreSeverityLevelsValid, simplify GetECRClient to direct return,
  extract newUnsupportedImageFinding helper to reduce duplication
- helpers.go: use map[string]struct{} instead of map[string]bool in
  dedupList for idiomatic set semantics, simplify variable names
- junit.go: simplify time.Duration(1) * time.Second to time.Second

Co-authored-by: Cursor <cursoragent@cursor.com>
@Andrey9kin Andrey9kin force-pushed the feat/aws-native-scanning-sdk-upgrade branch from 3f5d0f3 to 95f568d Compare February 12, 2026 12:45
Upgrade all indirect/transitive dependencies to their latest versions:
- Azure/go-ansiterm: 2021-06-17 -> 2025-01-02
- Microsoft/go-winio: v0.5.2 -> v0.6.2
- clipperhouse/displaywidth: v0.6.2 -> v0.10.0
- clipperhouse/uax29/v2: v2.3.0 -> v2.6.0
- docker/go-connections: v0.4.0 -> v0.6.0
- docker/go-units: v0.4.0 -> v0.5.0
- moby/term: 2021-06-19 -> v0.5.2
- morikuni/aec: v1.0.0 -> v1.1.0
- olekukonko/errors: v1.1.0 -> v1.2.0
- olekukonko/ll: v0.1.4-pre -> v0.1.5
- opencontainers/image-spec: v1.0.3-pre -> v1.1.1
- xrash/smetrics: 2024-05-21 -> 2025-07-05
- golang.org/x/net: v0.49.0 -> v0.50.0
- golang.org/x/sys: v0.40.0 -> v0.41.0

Removed unused clipperhouse/stringish indirect dependency.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Andrey9kin Andrey9kin merged commit fe53e57 into master Feb 12, 2026
2 checks passed
@Andrey9kin Andrey9kin deleted the feat/aws-native-scanning-sdk-upgrade branch February 12, 2026 12:50
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

continue
}
// Exhausted retries - treat as unsupported image
return newUnsupportedImageFinding("Image scan does not exist - image is not supported for scanning"), nil
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exhausted scan retries silently treated as unsupported image

Medium Severity

When ScanNotFoundException retries are exhausted after 5 minutes, the code returns an ECR_ERROR_UNSUPPORTED_IMAGE finding with a nil error instead of returning an error. This conflates "scan genuinely delayed or AWS service issue" with "image is unscannable." Users who ignore ECR_ERROR_UNSUPPORTED_IMAGE (as recommended for scratch images) would silently pass unscanned images through the security gate if the scan fails to initiate due to a transient AWS issue. Returning an error here would be safer, with a separate mechanism to detect truly unscannable images.

Additional Locations (1)

Fix in Cursor Fix in Web

@Andrey9kin Andrey9kin restored the feat/aws-native-scanning-sdk-upgrade branch February 12, 2026 13:49
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.

1 participant