Skip to content

[VULN-59766] Remove direct dependency on github.com/docker/docker v28#31

Closed
L3n41c wants to merge 66 commits intomainfrom
lenaic/VULN-59766-remove-docker-docker-v28-dependency
Closed

[VULN-59766] Remove direct dependency on github.com/docker/docker v28#31
L3n41c wants to merge 66 commits intomainfrom
lenaic/VULN-59766-remove-docker-docker-v28-dependency

Conversation

@L3n41c
Copy link
Copy Markdown
Member

@L3n41c L3n41c commented Apr 2, 2026

Summary

  • Migrate all direct imports of github.com/docker/docker to the equivalent github.com/moby/moby sub-modules (client v0.2.2 and api v1.53.0)
  • Replace docker/docker/pkg/system.Lgetxattr with containerd/continuity/sysx.LGetxattr (DataDog-specific container artifact)
  • Replace HostConfigModifier callbacks with AutoRemove field on testcontainers.ContainerRequest in all integration tests
  • Add replace directive redirecting the remaining indirect docker/docker to the patched moby/moby 27.x branch commit

Context

github.com/docker/docker v27 has known security vulnerabilities. This PR eliminates all direct usage so that DataDog/datadog-agent can consume this trivy version without pulling in the vulnerable package.

Ports the upstream migration from aquasecurity/trivy#10202 (Docker client SDK v29) adapted to the v27-era codebase of this branch.

Jira: VULN-59766, VULN-59767, VULN-59774, VULN-59775, CONTINT-5217, CONTINT-5218, CONTINT-5219, CONTINT-5220

Related: DataDog/datadog-agent#48777

Test plan

  • go mod tidy completes successfully
  • go build ./... compiles without errors (pre-existing internal/testutil/util.go issue excluded)
  • go vet passes on all modified packages
  • go test ./pkg/fanal/image/daemon/... — all unit tests pass
  • No remaining direct github.com/docker/docker imports in Go source files
  • docker/docker is now // indirect in go.mod, redirected via replace to patched moby/moby

🤖 Generated with Claude Code

0intro and others added 30 commits March 21, 2025 15:24
This change removes the following packages to reduce
the size of the Trivy library:

- magefiles
- pkg/cloud
- pkg/compliance
- pkg/iac
- pkg/k8s
- pkg/misconf
- pkg/policy
Co-Authored-By: David du Colombier <djc@datadoghq.com>
This change reverts parts of the the changes done in commit:

Re-use existing `ErrorCallback` WalkOption in post-analysis fs walks

Reading the content of the /var/lib/dpkg/info directory is
optional and the /var/lib/dpkg/status.d directory is particularly
uncommon. We should not trigger errors when these directory are
not existing.
0intro and others added 21 commits June 23, 2025 12:02
In RHEL 9 for Edge, /var/lib/rpm is a symlink to
/usr/share/rpm.
Instead of specifying the tagged reference, let's allow creating
a container artifact with multiple repository tags.
@L3n41c L3n41c force-pushed the lenaic/VULN-59766-remove-docker-docker-v28-dependency branch from cc1062b to 5ada670 Compare April 2, 2026 13:33
…thub.com/moby/moby

Migrate all direct imports of github.com/docker/docker to the
equivalent github.com/moby/moby sub-modules (client v0.2.2 and
api v1.53.0), eliminating the vulnerable dependency from production
and test code.

Production code:
- pkg/fanal/image/daemon: migrate Docker client, types, and API calls
  to moby/moby/client and moby/moby/api/types/image
- pkg/fanal/artifact/container: replace docker/docker/pkg/system with
  containerd/continuity/sysx for Lgetxattr

Test code:
- Replace HostConfigModifier callbacks with AutoRemove field on
  testcontainers.ContainerRequest in all integration tests
- Migrate all test imports from docker/docker to moby/moby equivalents
- Update test expected values for the new InspectResponse type

go.mod:
- Add direct dependencies on moby/moby/client and moby/moby/api
- docker/docker demoted to indirect (transitive only)
- Add replace directive redirecting docker/docker to patched moby/moby
  27.x branch commit (v27.5.2-0.20250218170852-77446557b0f8)

Jira: VULN-59766, VULN-59767, VULN-59774, VULN-59775
Jira: CONTINT-5217, CONTINT-5218, CONTINT-5219, CONTINT-5220

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@L3n41c L3n41c force-pushed the lenaic/VULN-59766-remove-docker-docker-v28-dependency branch from 5ada670 to dce2871 Compare April 7, 2026 18:49
@L3n41c L3n41c changed the title [VULN-59766] Remove direct dependency on github.com/docker/docker v28 [VULN-59766] Migrate from github.com/docker/docker to github.com/moby/moby Apr 7, 2026
@L3n41c L3n41c changed the title [VULN-59766] Migrate from github.com/docker/docker to github.com/moby/moby [VULN-59766] Remove direct dependency on github.com/docker/docker v28 Apr 7, 2026
sysx.LGetxattr (from containerd/continuity) returns an error for
ENODATA (attribute not set), whereas the previous docker/docker
system.Lgetxattr returned (nil, nil). Without this fix, the container
layer walk would fail on every directory lacking the overlay opaque
xattr — i.e. virtually all directories.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@L3n41c
Copy link
Copy Markdown
Member Author

L3n41c commented Apr 8, 2026

Superseded by #32.

@L3n41c L3n41c closed this Apr 8, 2026
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.

8 participants