From 9b51892b8061ff03e91e8aad41e86cad21057272 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 6 Mar 2026 13:52:18 +0100 Subject: [PATCH 01/25] update to go1.25.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit go1.25.8 (released 2026-03-05) includes security fixes to the html/template, net/url, and os packages, as well as bug fixes to the go command, the compiler, and the os package. See the Go 1.25.8 milestone on our issue tracker for details. - 1.25.8 https://github.com/golang/go/issues?q=milestone%3AGo1.25.8+label%3ACherryPickApproved - diff: https://github.com/golang/go/compare/go1.25.7...go1.25.8 - 1.26.1 https://github.com/golang/go/issues?q=milestone%3AGo1.26.1+label%3ACherryPickApproved - diff: https://github.com/golang/go/compare/go1.26.0...go1.26.1 --- We have just released Go versions 1.26.1 and 1.25.8, minor point releases. These releases include 5 security fixes following the security policy: crypto/x509: incorrect enforcement of email constraints - When verifying a certificate chain which contains a certificate containing multiple email address constraints (composed of the full email address) which share common local portions (the portion of the address before the '@' character) but different domain portions (the portion of the address after the '@' character), these constraints will not be properly applied, and only the last constraint will be considered. This can allow certificates in the chain containing email addresses which are either not permitted or excluded by the relevant constraints to be returned by calls to Certificate.Verify. Since the name constraint checks happen after chain building is complete, this only applies to certificate chains which chain to trusted roots (root certificates either in VerifyOptions.Roots or in the system root certificate pool), requiring a trusted CA to issue certificates containing either not permitted or excluded email addresses. This issue only affects Go 1.26. Thanks to Jakub Ciolek for reporting this issue. This is CVE-2026-27137 and Go issue https://go.dev/issue/77952. - crypto/x509: panic in name constraint checking for malformed certificates Certificate verification can panic when a certificate in the chain has an empty DNS name and another certificate in the chain has excluded name constraints. This can crash programs that are either directly verifying X.509 certificate chains, or those that use TLS. Since the name constraint checks happen after chain building is complete, this only applies to certificate chains which chain to trusted roots (root certificates either in VerifyOptions.Roots or in the system root certificate pool), requiring a trusted CA to issue certificates containing malformed DNS names. This issue only affects Go 1.26. Thanks to Jakub Ciolek for reporting this issue. This is CVE-2026-27138 and Go issue https://go.dev/issue/77953. - html/template: URLs in meta content attribute actions are not escaped Actions which insert URLs into the content attribute of HTML meta tags are not escaped. This can allow XSS if the meta tag also has an http-equiv attribute with the value "refresh". A new GODEBUG setting has been added, htmlmetacontenturlescape, which can be used to disable escaping URLs in actions in the meta content attribute which follow "url=" by setting htmlmetacontenturlescape=0. This is CVE-2026-27142 and Go issue https://go.dev/issue/77954. - net/url: reject IPv6 literal not at start of host The Go standard library function net/url.Parse insufficiently validated the host/authority component and accepted some invalid URLs by effectively treating garbage before an IP-literal as ignorable. The function should have rejected this as invalid. To prevent this behavior, net/url.Parse now rejects IPv6 literals that do not appear at the start of the host subcomponent of a URL. Thanks to Masaki Hara (https://github.com/qnighy) of Wantedly. This is CVE-2026-25679 and Go issue https://go.dev/issue/77578. - os: FileInfo can escape from a Root On Unix platforms, when listing the contents of a directory using File.ReadDir or File.Readdir the returned FileInfo could reference a file outside of the Root in which the File was opened. The contents of the FileInfo were populated using the lstat system call, which takes the path to the file as a parameter. If a component of the full path of the file described by the FileInfo is replaced with a symbolic link, the target of the lstat can be directed to another location on the filesystem. The impact of this escape is limited to reading metadata provided by lstat from arbitrary locations on the filesystem. This could be used to probe for the presence or absence of files as well as gleaning metadata like file sizes, but does not permit reading or writing files outside the root. The FileInfo is now populated using fstatat. Thank you to Miloslav Trmač of Red Hat for reporting this issue. This is CVE-2026-27139 and Go issue https://go.dev/issue/77827. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit f7d83cbae878257edce743b95355eac78d846ae8) Signed-off-by: Sebastiaan van Stijn --- .github/workflows/codeql.yml | 2 +- .github/workflows/test.yml | 2 +- .golangci.yml | 2 +- Dockerfile | 2 +- dockerfiles/Dockerfile.dev | 2 +- dockerfiles/Dockerfile.lint | 2 +- dockerfiles/Dockerfile.vendor | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index cf7dcf1742df..b1b430a3680d 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -63,7 +63,7 @@ jobs: name: Update Go uses: actions/setup-go@v6 with: - go-version: "1.25.7" + go-version: "1.25.8" - name: Initialize CodeQL uses: github/codeql-action/init@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 899bc0143de1..1be65deccad0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -67,7 +67,7 @@ jobs: name: Set up Go uses: actions/setup-go@v6 with: - go-version: "1.25.7" + go-version: "1.25.8" - name: Test run: | diff --git a/.golangci.yml b/.golangci.yml index 764185372160..8024a7864f17 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -5,7 +5,7 @@ run: # which causes it to fallback to go1.17 semantics. # # TODO(thaJeztah): update "usetesting" settings to enable go1.24 features once our minimum version is go1.24 - go: "1.25.7" + go: "1.25.8" timeout: 5m diff --git a/Dockerfile b/Dockerfile index 49f3d203af35..45a582c23c68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ ARG BASE_VARIANT=alpine ARG ALPINE_VERSION=3.23 ARG BASE_DEBIAN_DISTRO=bookworm -ARG GO_VERSION=1.25.7 +ARG GO_VERSION=1.25.8 # XX_VERSION specifies the version of the xx utility to use. # It must be a valid tag in the docker.io/tonistiigi/xx image repository. diff --git a/dockerfiles/Dockerfile.dev b/dockerfiles/Dockerfile.dev index 8e172845cb58..4493c22138e7 100644 --- a/dockerfiles/Dockerfile.dev +++ b/dockerfiles/Dockerfile.dev @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.25.7 +ARG GO_VERSION=1.25.8 # ALPINE_VERSION sets the version of the alpine base image to use, including for the golang image. # It must be a supported tag in the docker.io/library/alpine image repository diff --git a/dockerfiles/Dockerfile.lint b/dockerfiles/Dockerfile.lint index 1e996bdc5bca..24da2e13ba7f 100644 --- a/dockerfiles/Dockerfile.lint +++ b/dockerfiles/Dockerfile.lint @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.25.7 +ARG GO_VERSION=1.25.8 # ALPINE_VERSION sets the version of the alpine base image to use, including for the golang image. # It must be a supported tag in the docker.io/library/alpine image repository diff --git a/dockerfiles/Dockerfile.vendor b/dockerfiles/Dockerfile.vendor index 566548f3e3c9..ed3ab0de93c8 100644 --- a/dockerfiles/Dockerfile.vendor +++ b/dockerfiles/Dockerfile.vendor @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.25.7 +ARG GO_VERSION=1.25.8 # ALPINE_VERSION sets the version of the alpine base image to use, including for the golang image. # It must be a supported tag in the docker.io/library/alpine image repository From 6d71967120b4cdbb556211c7a2514c42dcb2e582 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 10 Mar 2026 11:18:28 +0100 Subject: [PATCH 02/25] cli/command: add missing "go:build" comments - commit e8dc2fce32f2b0cfc6e5e04599bcdab363dbc022 modernized loops to range over int, which requires go1.22 or later. - commit 85ebca52fd8d711dc0303e6872392bb2b03e0bea modernized code to use stdlib min/max, which requires go1.21 or later. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 9a471180cb7d39c236d090399a9d362c3f5a8ebd) Signed-off-by: Sebastiaan van Stijn --- cli/command/container/opts.go | 2 +- cli/command/container/tty.go | 3 +++ cli/command/service/progress/progress.go | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cli/command/container/opts.go b/cli/command/container/opts.go index 9caa830a0d7b..c4dcea38e9e4 100644 --- a/cli/command/container/opts.go +++ b/cli/command/container/opts.go @@ -1,4 +1,4 @@ -// FIXME(vvoland): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: +// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: //go:build go1.24 package container diff --git a/cli/command/container/tty.go b/cli/command/container/tty.go index 89352f789851..a9a0b70ec364 100644 --- a/cli/command/container/tty.go +++ b/cli/command/container/tty.go @@ -1,3 +1,6 @@ +// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: +//go:build go1.24 + package container import ( diff --git a/cli/command/service/progress/progress.go b/cli/command/service/progress/progress.go index 94b59d950eea..fc6ff7eb52f5 100644 --- a/cli/command/service/progress/progress.go +++ b/cli/command/service/progress/progress.go @@ -1,3 +1,6 @@ +// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: +//go:build go1.24 + package progress import ( From af45a23fa9a06cb282294054d213b9b0fbae1ac7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2026 08:42:41 +0000 Subject: [PATCH 03/25] build(deps): bump docker/bake-action from 6 to 7 Bumps [docker/bake-action](https://github.com/docker/bake-action) from 6 to 7. - [Release notes](https://github.com/docker/bake-action/releases) - [Commits](https://github.com/docker/bake-action/compare/v6...v7) --- updated-dependencies: - dependency-name: docker/bake-action dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] (cherry picked from commit 6453c4c3a7e55d2fbfc98e66116ae416d5b75452) Signed-off-by: Sebastiaan van Stijn --- .github/workflows/build.yml | 6 +++--- .github/workflows/test.yml | 2 +- .github/workflows/validate.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f12472c678f5..da3ab4487d3b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,7 +66,7 @@ jobs: uses: docker/setup-buildx-action@v4 - name: Build - uses: docker/bake-action@v6 + uses: docker/bake-action@v7 with: targets: ${{ matrix.target }} set: | @@ -125,7 +125,7 @@ jobs: type=semver,pattern={{major}}.{{minor}} - name: Build and push image - uses: docker/bake-action@v6 + uses: docker/bake-action@v7 with: files: | ./docker-bake.hcl @@ -168,7 +168,7 @@ jobs: uses: docker/setup-buildx-action@v4 - name: Build - uses: docker/bake-action@v6 + uses: docker/bake-action@v7 with: targets: plugins-cross set: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 899bc0143de1..2a8eed8a24ed 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: uses: docker/setup-buildx-action@v4 - name: Test - uses: docker/bake-action@v6 + uses: docker/bake-action@v7 with: targets: test-coverage - diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index e6508d8fc783..3e1e64150313 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -38,7 +38,7 @@ jobs: steps: - name: Run - uses: docker/bake-action@v6 + uses: docker/bake-action@v7 with: targets: ${{ matrix.target }} From 9709c8fe08f902f0aa41ffffaa00085ab39aecd8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2026 08:42:45 +0000 Subject: [PATCH 04/25] build(deps): bump docker/metadata-action from 5 to 6 Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 5 to 6. - [Release notes](https://github.com/docker/metadata-action/releases) - [Commits](https://github.com/docker/metadata-action/compare/v5...v6) --- updated-dependencies: - dependency-name: docker/metadata-action dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] (cherry picked from commit 39d676c72d113929fe9e49a902810135545d1dd0) Signed-off-by: Sebastiaan van Stijn --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index da3ab4487d3b..68202ef30730 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -114,7 +114,7 @@ jobs: - name: Docker meta id: meta - uses: docker/metadata-action@v5 + uses: docker/metadata-action@v6 with: images: dockereng/cli-bin tags: | From 0da6a5121f81387dc7eeba18f928c7e6f3d5cd9d Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 25 Mar 2026 14:29:11 +0100 Subject: [PATCH 05/25] ci: pin actions to digests As a follow-up, we should use the full version (major.minor.patch). Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 97b9e04a940c3e83fcd588f8442204f2e7e0c5c4) Signed-off-by: Sebastiaan van Stijn --- .github/dependabot.yml | 2 ++ .github/workflows/build.yml | 24 ++++++++++++------------ .github/workflows/codeql.yml | 11 ++++++----- .github/workflows/e2e.yml | 6 +++--- .github/workflows/test.yml | 13 +++++++------ .github/workflows/validate.yml | 6 +++--- 6 files changed, 33 insertions(+), 29 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 53a17bae892a..dd1d00a4ba2d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,3 +7,5 @@ updates: labels: - "area/testing" - "status/2-code-review" + cooldown: + default-days: 7 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68202ef30730..5628a03788a7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,7 +35,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Create matrix id: platforms @@ -63,10 +63,10 @@ jobs: steps: - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 + uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4 - name: Build - uses: docker/bake-action@v7 + uses: docker/bake-action@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7 with: targets: ${{ matrix.target }} set: | @@ -88,7 +88,7 @@ jobs: fi - name: Upload artifacts - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: ${{ env.ARTIFACT_NAME }} path: /tmp/out/* @@ -101,20 +101,20 @@ jobs: - name: Login to DockerHub if: github.event_name != 'pull_request' - uses: docker/login-action@v4 + uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4 with: username: ${{ secrets.DOCKERHUB_CLIBIN_USERNAME }} password: ${{ secrets.DOCKERHUB_CLIBIN_TOKEN }} - name: Set up QEMU - uses: docker/setup-qemu-action@v4 + uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 + uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4 - name: Docker meta id: meta - uses: docker/metadata-action@v6 + uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6 with: images: dockereng/cli-bin tags: | @@ -125,7 +125,7 @@ jobs: type=semver,pattern={{major}}.{{minor}} - name: Build and push image - uses: docker/bake-action@v7 + uses: docker/bake-action@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7 with: files: | ./docker-bake.hcl @@ -143,7 +143,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Create matrix id: platforms @@ -165,10 +165,10 @@ jobs: steps: - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 + uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4 - name: Build - uses: docker/bake-action@v7 + uses: docker/bake-action@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7 with: targets: plugins-cross set: | diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index b1b430a3680d..e9155fe2062b 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -46,7 +46,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: fetch-depth: 2 # CodeQL 2.16.4's auto-build added support for multi-module repositories, @@ -61,19 +61,20 @@ jobs: ln -s vendor.sum go.sum - name: Update Go - uses: actions/setup-go@v6 + uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6 with: go-version: "1.25.8" + cache: false - name: Initialize CodeQL - uses: github/codeql-action/init@v4 + uses: github/codeql-action/init@38697555549f1db7851b81482ff19f1fa5c4fedc # v4.34.1 with: languages: go - name: Autobuild - uses: github/codeql-action/autobuild@v4 + uses: github/codeql-action/autobuild@38697555549f1db7851b81482ff19f1fa5c4fedc # v4.34.1 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4 + uses: github/codeql-action/analyze@38697555549f1db7851b81482ff19f1fa5c4fedc # v4.34.1 with: category: "/language:go" diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index a2e2076fbeb8..e895fc9877a6 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -44,7 +44,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Update daemon.json run: | @@ -63,7 +63,7 @@ jobs: docker info - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 + uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4 - name: Run ${{ matrix.target }} run: | @@ -74,7 +74,7 @@ jobs: TESTFLAGS: -coverprofile=/tmp/coverage/coverage.txt - name: Send to Codecov - uses: codecov/codecov-action@v5 + uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5 with: files: ./build/coverage/coverage.txt token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f17f36363b2c..b3f8de89e669 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,15 +30,15 @@ jobs: steps: - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 + uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4 - name: Test - uses: docker/bake-action@v7 + uses: docker/bake-action@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7 with: targets: test-coverage - name: Send to Codecov - uses: codecov/codecov-action@v5 + uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5 with: files: ./build/coverage/coverage.txt token: ${{ secrets.CODECOV_TOKEN }} @@ -60,14 +60,15 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: path: ${{ env.GOPATH }}/src/github.com/docker/cli - name: Set up Go - uses: actions/setup-go@v6 + uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6 with: go-version: "1.25.8" + cache: false - name: Test run: | @@ -80,7 +81,7 @@ jobs: shell: bash - name: Send to Codecov - uses: codecov/codecov-action@v5 + uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5 with: files: /tmp/coverage.txt working-directory: ${{ env.GOPATH }}/src/github.com/docker/cli diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 3e1e64150313..afa834b9c829 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -38,7 +38,7 @@ jobs: steps: - name: Run - uses: docker/bake-action@v7 + uses: docker/bake-action@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7 with: targets: ${{ matrix.target }} @@ -48,7 +48,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Generate shell: 'script --return --quiet --command "bash {0}"' @@ -74,7 +74,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Run shell: 'script --return --quiet --command "bash {0}"' From 49a1af6aaa6fac88e6da6a46951a4d52bb81d8b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Wed, 8 Jul 2026 15:18:58 +0200 Subject: [PATCH 06/25] gha: Add release branch sync workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a manually dispatched workflow for maintainers to sync a Docker release branch to a selected release tag. The sync-release-branch job checks out the release branch, computes the list of unmerged tags up to the requested tag via scripts/unmerged-tags, merges them in order via scripts/sync-branch using git merge --no-ff (resolving conflicts by taking the tag's content), then pushes the result to a temporary branch. The push-release-branch job runs after manual approval via the docker-releases environment. It verifies that neither the release branch nor the temporary branch moved since the sync job ran before force-advancing the release branch and deleting the temporary branch. Signed-off-by: Paweł Gronowski (cherry picked from commit 182f56fe8c587efab21a0e79952672d42ea28aa5) Signed-off-by: Paweł Gronowski --- .github/workflows/sync-release-branch.yml | 137 ++++++++++++++++++++++ scripts/sync-branch | 34 ++++++ scripts/unmerged-tags | 48 ++++++++ 3 files changed, 219 insertions(+) create mode 100644 .github/workflows/sync-release-branch.yml create mode 100755 scripts/sync-branch create mode 100755 scripts/unmerged-tags diff --git a/.github/workflows/sync-release-branch.yml b/.github/workflows/sync-release-branch.yml new file mode 100644 index 000000000000..2bbdab4b96f9 --- /dev/null +++ b/.github/workflows/sync-release-branch.yml @@ -0,0 +1,137 @@ +name: Sync Docker release branch + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: false + +permissions: + contents: read + +on: + workflow_dispatch: + inputs: + tag: + description: Tag to sync from, for example v29.6.0 + required: true + type: string + dry_run: + description: Merge but don't push + required: true + default: false + type: boolean + +jobs: + sync-release-branch: + runs-on: ubuntu-24.04 + permissions: + contents: write + outputs: + base_sha: ${{ steps.sync.outputs.base_sha }} + has_changes: ${{ steps.sync.outputs.has_changes }} + temporary_branch: ${{ steps.sync.outputs.temporary_branch }} + temporary_sha: ${{ steps.sync.outputs.temporary_sha }} + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + fetch-depth: 0 + + - name: Validate + env: + BRANCH: ${{ github.ref_name }} + run: | + if [ "$BRANCH" = "master" ]; then + echo "::error::This workflow is expected to be run on a release branch, not master" + exit 1 + fi + + - name: Configure git author + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Sync release branch to tag range + id: sync + env: + DRY_RUN: ${{ inputs.dry_run }} + RELEASE_BRANCH: ${{ github.ref_name }} + RUN_ATTEMPT: ${{ github.run_attempt }} + RUN_ID: ${{ github.run_id }} + TAG: ${{ inputs.tag }} + run: | + set -o pipefail + base_sha=$(git rev-parse "origin/$RELEASE_BRANCH") + temporary_branch="process/sync-release-branch/$RUN_ID-$RUN_ATTEMPT" + echo "base_sha=$base_sha" >> "$GITHUB_OUTPUT" + echo "temporary_branch=$temporary_branch" >> "$GITHUB_OUTPUT" + + tags_file=$(mktemp) + scripts/unmerged-tags \ + "$RELEASE_BRANCH" \ + "$TAG" \ + > "$tags_file" + + echo >> "$GITHUB_STEP_SUMMARY" + echo "## Tags to sync" >> "$GITHUB_STEP_SUMMARY" + echo >> "$GITHUB_STEP_SUMMARY" + sed 's/^/- /' "$tags_file" >> "$GITHUB_STEP_SUMMARY" + + xargs -r scripts/sync-branch < "$tags_file" | tee -a "$GITHUB_STEP_SUMMARY" + + if [[ "$DRY_RUN" == "true" ]]; then + echo "has_changes=false" >> "$GITHUB_OUTPUT" + exit 0 + fi + + if [[ $(git rev-parse HEAD) == $(git rev-parse "origin/$RELEASE_BRANCH") ]]; then + echo "has_changes=false" >> "$GITHUB_OUTPUT" + echo "No changes to push" + exit 0 + fi + + echo "has_changes=true" >> "$GITHUB_OUTPUT" + git push origin "HEAD:refs/heads/$temporary_branch" + echo "temporary_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + + push-release-branch: + needs: sync-release-branch + if: ${{ !inputs.dry_run && needs.sync-release-branch.outputs.has_changes == 'true' }} + runs-on: ubuntu-24.04 + environment: docker-releases + permissions: + contents: write + timeout-minutes: 10 + steps: + - name: Checkout release + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + fetch-depth: 0 + + - name: Push release branch + env: + BASE_SHA: ${{ needs.sync-release-branch.outputs.base_sha }} + RELEASE_BRANCH: ${{ github.ref_name }} + TEMPORARY_BRANCH: ${{ needs.sync-release-branch.outputs.temporary_branch }} + TEMPORARY_SHA: ${{ needs.sync-release-branch.outputs.temporary_sha }} + run: | + git fetch origin "$RELEASE_BRANCH" + current_sha=$(git rev-parse "origin/$RELEASE_BRANCH") + if [[ "$current_sha" != "$BASE_SHA" ]]; then + echo "$RELEASE_BRANCH changed from $BASE_SHA to $current_sha" + exit 1 + fi + + git fetch origin "$TEMPORARY_BRANCH" + current_temporary_sha=$(git rev-parse FETCH_HEAD) + if [[ "$current_temporary_sha" != "$TEMPORARY_SHA" ]]; then + echo "$TEMPORARY_BRANCH changed from $TEMPORARY_SHA to $current_temporary_sha" + exit 1 + fi + + git push origin "FETCH_HEAD:$RELEASE_BRANCH" + + - name: Delete temporary branch + env: + TEMPORARY_BRANCH: ${{ needs.sync-release-branch.outputs.temporary_branch }} + run: git push origin --delete "$TEMPORARY_BRANCH" diff --git a/scripts/sync-branch b/scripts/sync-branch new file mode 100755 index 000000000000..4da920c10b3c --- /dev/null +++ b/scripts/sync-branch @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# Merge the given release tags. +set -Eeuo pipefail + +if [[ $# -lt 1 ]]; then + echo "usage: $0 TAG..." >&2 + exit 1 +fi + +tags_to_sync=("$@") + +for tag_to_sync in "${tags_to_sync[@]}"; do + if git merge --no-ff "$tag_to_sync"; then + continue + fi + + if ! git rev-parse --verify --quiet MERGE_HEAD > /dev/null || git diff --quiet --diff-filter=U; then + exit 1 + fi + + git checkout "$tag_to_sync" -- '.' + git add --all + git merge --continue +done + +# Check that every tag is in the branch. +# This catches cases where a merge did not actually incorporate one of the +# requested release tags. +for tag_to_sync in "${tags_to_sync[@]}"; do + if ! git merge-base --is-ancestor "$tag_to_sync" HEAD; then + echo "tag $tag_to_sync is not contained in $(git rev-parse --abbrev-ref HEAD)" >&2 + exit 1 + fi +done diff --git a/scripts/unmerged-tags b/scripts/unmerged-tags new file mode 100755 index 000000000000..57b90666af3c --- /dev/null +++ b/scripts/unmerged-tags @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +if [[ $# -ne 2 ]]; then + echo "usage: $0 " >&2 + exit 1 +fi + +release_branch="$1" +tag="$2" + +if [[ "$tag" == *"-rc."* ]]; then + echo "error: RC tags cannot be used as sync targets" >&2 + exit 1 +fi + +if [[ "$tag" != v* ]]; then + echo "error: Tag must start with 'v' (e.g. v29.6.0)" >&2 + exit 1 +fi + +if ! git rev-parse --verify --quiet "refs/tags/$tag" > /dev/null; then + echo "error: Tag $tag does not exist" >&2 + exit 1 +fi + +# Return early the requested tag is already merged into release branch. +if git merge-base --is-ancestor "$tag" "$release_branch"; then + exit 0 +fi + +if git rev-parse --verify --quiet upstream/master > /dev/null 2>&1; then + master="upstream/master" +else + master="origin/master" +fi + +if ! git merge-base --is-ancestor "$tag" "$master"; then + echo "error: Tag $tag is not in $master" >&2 + exit 1 +fi + +# Get all docker release tags merged into master but not into release branch +git tag --merged "$master" --no-merged "$release_branch" \ + | grep '^v' \ + | grep -v -- "-rc." \ + | sort -V \ + | awk -v tag="$tag" '{print} $0==tag{exit}' From f72fb0caf0e539e490de93e4182a29f68b8127c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Thu, 9 Jul 2026 16:47:11 +0200 Subject: [PATCH 07/25] scripts/sync-branch: Fix non-interactive merge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Paweł Gronowski (cherry picked from commit f57e5284570c6b734442c18101756d672486a970) Signed-off-by: Paweł Gronowski --- scripts/sync-branch | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/sync-branch b/scripts/sync-branch index 4da920c10b3c..ed24e507ffcc 100755 --- a/scripts/sync-branch +++ b/scripts/sync-branch @@ -10,7 +10,7 @@ fi tags_to_sync=("$@") for tag_to_sync in "${tags_to_sync[@]}"; do - if git merge --no-ff "$tag_to_sync"; then + if git merge --no-edit --no-ff "$tag_to_sync"; then continue fi @@ -20,7 +20,9 @@ for tag_to_sync in "${tags_to_sync[@]}"; do git checkout "$tag_to_sync" -- '.' git add --all - git merge --continue + + # Can't use --no-edit with --continue + EDITOR=true git merge --continue done # Check that every tag is in the branch. From dba867594c282175d6b6dca05e5df6da2719e78f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Thu, 16 Jul 2026 12:51:30 +0200 Subject: [PATCH 08/25] Bump to 29.6.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Paweł Gronowski --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index d73ed40a839d..2c11dc9aa1a2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -29.6.1 +29.6.2 From a98becc3e3d9e9e08781f071d869ef12bee09d7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Tue, 20 Oct 2026 12:36:49 +0200 Subject: [PATCH 09/25] Bump version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Paweł Gronowski --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 6839beeeedfe..89eac39afbbf 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -29.8.1 +29.8.2 From baf6c1388976da8b0992bb33a423ad53dbc661c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Tue, 20 Oct 2026 12:40:09 +0200 Subject: [PATCH 10/25] Bump version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Paweł Gronowski --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 7012061eeca6..c779e025f075 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -29.9.1 +29.9.2 From e35bc1b6aeea2c5a7ddfcc8e88dd8c66b7642c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Tue, 20 Oct 2026 12:42:59 +0200 Subject: [PATCH 11/25] Update to go1.26.10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These releases include 1 security fix following the security policy: - crypto/x509: mitigation for security concerns with a specific Certificate Authority We're blocking trust in a small set of intermediate certificates due to specific security concerns around their operation. Verify will now filter out chains which contain these intermediates, preventing them from being returned to the caller. We highly recommend immediately upgrading to this release. This is CVE-2026-111943 and Go issue https://go.dev/issue/82345. release notes: https://go.dev/doc/devel/release#go1.26.10 Signed-off-by: Paweł Gronowski --- .github/workflows/codeql.yml | 2 +- .github/workflows/test.yml | 2 +- .github/workflows/validate.yml | 2 +- .golangci.yml | 2 +- Dockerfile | 2 +- dockerfiles/Dockerfile.dev | 2 +- dockerfiles/Dockerfile.lint | 2 +- dockerfiles/Dockerfile.vendor | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 73435198ca36..e15914f8451e 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -64,7 +64,7 @@ jobs: name: Update Go uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: - go-version: "1.27.1" + go-version: "1.26.10" cache: false - name: Initialize CodeQL diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0714b6345c50..5b2fec40e59a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -68,7 +68,7 @@ jobs: name: Set up Go uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: - go-version: "1.27.1" + go-version: "1.26.10" cache: false - name: Test diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 3f693dd8530d..981b6864e0b1 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -101,7 +101,7 @@ jobs: name: Set up Go uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: - go-version: "1.27.1" + go-version: "1.26.10" cache: false - name: Run gocompat check diff --git a/.golangci.yml b/.golangci.yml index ac804566511b..24186a0bef0c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -5,7 +5,7 @@ run: # which causes it to fallback to go1.17 semantics. # # TODO(thaJeztah): update "usetesting" settings to enable go1.24 features once our minimum version is go1.24 - go: "1.26.9" + go: "1.26.10" timeout: 5m diff --git a/Dockerfile b/Dockerfile index 24eca2532993..8894b38509c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ ARG BASE_VARIANT=alpine ARG ALPINE_VERSION=3.23 ARG BASE_DEBIAN_DISTRO=bookworm -ARG GO_VERSION=1.26.9 +ARG GO_VERSION=1.26.10 # XX_VERSION specifies the version of the xx utility to use. # It must be a valid tag in the docker.io/tonistiigi/xx image repository. diff --git a/dockerfiles/Dockerfile.dev b/dockerfiles/Dockerfile.dev index 5c310953f707..f76837818ce6 100644 --- a/dockerfiles/Dockerfile.dev +++ b/dockerfiles/Dockerfile.dev @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.26.9 +ARG GO_VERSION=1.26.10 # ALPINE_VERSION sets the version of the alpine base image to use, including for the golang image. # It must be a supported tag in the docker.io/library/alpine image repository diff --git a/dockerfiles/Dockerfile.lint b/dockerfiles/Dockerfile.lint index e6acf6f71863..2ae7aa1972ee 100644 --- a/dockerfiles/Dockerfile.lint +++ b/dockerfiles/Dockerfile.lint @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.26.9 +ARG GO_VERSION=1.26.10 # ALPINE_VERSION sets the version of the alpine base image to use, including for the golang image. # It must be a supported tag in the docker.io/library/alpine image repository diff --git a/dockerfiles/Dockerfile.vendor b/dockerfiles/Dockerfile.vendor index 442e88286e1f..591867cb1968 100644 --- a/dockerfiles/Dockerfile.vendor +++ b/dockerfiles/Dockerfile.vendor @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.26.9 +ARG GO_VERSION=1.26.10 # ALPINE_VERSION sets the version of the alpine base image to use, including for the golang image. # It must be a supported tag in the docker.io/library/alpine image repository From 160531c55d31e0ab83b5cca96720929a4a4f975d Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 20 Oct 2026 12:46:38 +0200 Subject: [PATCH 12/25] vendor: github.com/fvbommel/sortorder v1.2.1 full diff: https://github.com/fvbommel/sortorder/compare/v1.2.0...v1.2.1 Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 16004189445845a8921cbb4653d0a1dadbe29cca) Signed-off-by: Sebastiaan van Stijn --- vendor.mod | 2 +- vendor.sum | 4 ++-- vendor/modules.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vendor.mod b/vendor.mod index 9b14b2e61eb9..f4263f736120 100644 --- a/vendor.mod +++ b/vendor.mod @@ -24,7 +24,7 @@ require ( github.com/docker/docker-credential-helpers v0.9.9 github.com/docker/go-connections v0.8.2 github.com/docker/go-units v0.5.0 - github.com/fvbommel/sortorder v1.2.0 + github.com/fvbommel/sortorder v1.2.1 github.com/go-jose/go-jose/v4 v4.1.5 github.com/go-viper/mapstructure/v2 v2.5.0 github.com/gogo/protobuf v1.3.2 diff --git a/vendor.sum b/vendor.sum index aa0e5e45f982..f0f2426bf585 100644 --- a/vendor.sum +++ b/vendor.sum @@ -49,8 +49,8 @@ github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 h1:UhxFibDNY/bfvqU github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc= github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE= -github.com/fvbommel/sortorder v1.2.0 h1:TRIiRiGX+djh3Yf4FVxmWmAcYfIr5dH0NbzJWOSAWZk= -github.com/fvbommel/sortorder v1.2.0/go.mod h1:LbhO04ijZIeUuvz9B9BkI/qYrpZZEn1gWhxv4QjUKVs= +github.com/fvbommel/sortorder v1.2.1 h1:ASc85RbthwLEqzuiCk7WQQiopfyGWQiEYZVJ3Qa4A+U= +github.com/fvbommel/sortorder v1.2.1/go.mod h1:LbhO04ijZIeUuvz9B9BkI/qYrpZZEn1gWhxv4QjUKVs= github.com/go-jose/go-jose/v4 v4.1.5 h1:RjgjO2LOtWOJKUC5wpwY9LR3B3vwVAz6JS2YHfYU6eA= github.com/go-jose/go-jose/v4 v4.1.5/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= diff --git a/vendor/modules.txt b/vendor/modules.txt index b1024ee9737b..622cc56e974c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -90,7 +90,7 @@ github.com/docker/go-units # github.com/felixge/httpsnoop v1.1.0 ## explicit; go 1.25 github.com/felixge/httpsnoop -# github.com/fvbommel/sortorder v1.2.0 +# github.com/fvbommel/sortorder v1.2.1 ## explicit; go 1.21 github.com/fvbommel/sortorder # github.com/go-jose/go-jose/v4 v4.1.5 From 68e452624ae9a68ce6412e91fbd7649ca12875ed Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 28 Oct 2026 22:38:48 +0100 Subject: [PATCH 13/25] vendor: github.com/go-jose/go-jose/v4 v4.1.6 - contains a fix for CVE-2026-116587 / [GHSA-mgcc-cww5-fp2q] full diff: https://github.com/go-jose/go-jose/compare/v4.1.5...v4.1.6 [GHSA-mgcc-cww5-fp2q]: https://github.com/go-jose/go-jose/security/advisories/GHSA-mgcc-cww5-fp2q Signed-off-by: Sebastiaan van Stijn (cherry picked from commit ccccec73b0e3c4ef4243a9dd77b3d759b7f1b909) Signed-off-by: Sebastiaan van Stijn --- vendor.mod | 2 +- vendor.sum | 4 +- .../github.com/go-jose/go-jose/v4/crypter.go | 15 ++++++ vendor/github.com/go-jose/go-jose/v4/jwe.go | 18 +++---- vendor/github.com/go-jose/go-jose/v4/jwk.go | 51 ++++++++++++++++--- vendor/github.com/go-jose/go-jose/v4/jws.go | 29 ++++++----- .../go-jose/go-jose/v4/jwt/errors.go | 2 +- .../github.com/go-jose/go-jose/v4/shared.go | 31 ++++------- .../go-jose/go-jose/v4/tests.Containerfile | 13 +++++ .../go-jose/go-jose/v4/threat_model.md | 25 +++++++++ vendor/modules.txt | 2 +- 11 files changed, 137 insertions(+), 55 deletions(-) create mode 100644 vendor/github.com/go-jose/go-jose/v4/tests.Containerfile create mode 100644 vendor/github.com/go-jose/go-jose/v4/threat_model.md diff --git a/vendor.mod b/vendor.mod index f4263f736120..884e7dc9f6cd 100644 --- a/vendor.mod +++ b/vendor.mod @@ -25,7 +25,7 @@ require ( github.com/docker/go-connections v0.8.2 github.com/docker/go-units v0.5.0 github.com/fvbommel/sortorder v1.2.1 - github.com/go-jose/go-jose/v4 v4.1.5 + github.com/go-jose/go-jose/v4 v4.1.6 github.com/go-viper/mapstructure/v2 v2.5.0 github.com/gogo/protobuf v1.3.2 github.com/google/go-cmp v0.7.0 diff --git a/vendor.sum b/vendor.sum index f0f2426bf585..f76036561a63 100644 --- a/vendor.sum +++ b/vendor.sum @@ -51,8 +51,8 @@ github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeO github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE= github.com/fvbommel/sortorder v1.2.1 h1:ASc85RbthwLEqzuiCk7WQQiopfyGWQiEYZVJ3Qa4A+U= github.com/fvbommel/sortorder v1.2.1/go.mod h1:LbhO04ijZIeUuvz9B9BkI/qYrpZZEn1gWhxv4QjUKVs= -github.com/go-jose/go-jose/v4 v4.1.5 h1:RjgjO2LOtWOJKUC5wpwY9LR3B3vwVAz6JS2YHfYU6eA= -github.com/go-jose/go-jose/v4 v4.1.5/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= +github.com/go-jose/go-jose/v4 v4.1.6 h1:sNRkftxFJxwsILiQukqp5z83QBSmntVwmgRY7AqBDO4= +github.com/go-jose/go-jose/v4 v4.1.6/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= diff --git a/vendor/github.com/go-jose/go-jose/v4/crypter.go b/vendor/github.com/go-jose/go-jose/v4/crypter.go index e3df79c2dc57..53636c57b335 100644 --- a/vendor/github.com/go-jose/go-jose/v4/crypter.go +++ b/vendor/github.com/go-jose/go-jose/v4/crypter.go @@ -428,6 +428,13 @@ func (ctx *genericEncrypter) Options() EncrypterOptions { } } +func validateContentEncryptionKeySize(cek []byte, cipher contentCipher) error { + if len(cek) != cipher.keySize() { + return ErrInvalidKeySize + } + return nil +} + // Decrypt and validate the object and return the plaintext. This // function does not support multi-recipient. If you desire multi-recipient // decryption use DecryptMulti instead. @@ -495,6 +502,10 @@ func (obj JSONWebEncryption) Decrypt(decryptionKey interface{}) ([]byte, error) if err != nil { return nil, ErrCryptoFailure } + err = validateContentEncryptionKeySize(cek, cipher) + if err != nil { + return nil, ErrCryptoFailure + } // Found a valid CEK -- let's try to decrypt. plaintext, err = cipher.decrypt(cek, authData, parts) @@ -572,6 +583,10 @@ func (obj JSONWebEncryption) DecryptMulti(decryptionKey interface{}) (int, Heade if err != nil { continue } + err = validateContentEncryptionKeySize(cek, cipher) + if err != nil { + continue + } // Found a valid CEK -- let's try to decrypt. plaintext, err = cipher.decrypt(cek, authData, parts) diff --git a/vendor/github.com/go-jose/go-jose/v4/jwe.go b/vendor/github.com/go-jose/go-jose/v4/jwe.go index ae173461b70e..a5169010787d 100644 --- a/vendor/github.com/go-jose/go-jose/v4/jwe.go +++ b/vendor/github.com/go-jose/go-jose/v4/jwe.go @@ -202,15 +202,6 @@ func (parsed *rawJSONWebEncryption) sanitized( } } - // Note: this must be called _after_ we parse the protected header, - // otherwise fields from the protected header will not get picked up. - var err error - mergedHeaders := obj.mergedHeaders(nil) - obj.Header, err = mergedHeaders.sanitized() - if err != nil { - return nil, fmt.Errorf("go-jose/go-jose: cannot sanitize merged headers: %v (%v)", err, mergedHeaders) - } - if len(parsed.Recipients) == 0 { obj.recipients = []recipientInfo{ { @@ -264,6 +255,15 @@ func (parsed *rawJSONWebEncryption) sanitized( } } + // Note: this must be called _after_ we parse the protected header, + // otherwise fields from the protected header will not get picked up. + mergedHeaders := obj.mergedHeaders(nil) + var err error + obj.Header, err = mergedHeaders.sanitized() + if err != nil { + return nil, fmt.Errorf("go-jose/go-jose: cannot sanitize merged headers: %w", err) + } + obj.iv = parsed.Iv.bytes() obj.ciphertext = parsed.Ciphertext.bytes() obj.tag = parsed.Tag.bytes() diff --git a/vendor/github.com/go-jose/go-jose/v4/jwk.go b/vendor/github.com/go-jose/go-jose/v4/jwk.go index f712ec7ec8fa..8b7aa05ec2ba 100644 --- a/vendor/github.com/go-jose/go-jose/v4/jwk.go +++ b/vendor/github.com/go-jose/go-jose/v4/jwk.go @@ -177,13 +177,29 @@ func (k JSONWebKey) MarshalJSON() ([]byte, error) { // UnmarshalJSON reads a key from its JSON representation. // // Returns ErrUnsupportedKeyType for unrecognized or unsupported "kty" header values. -func (k *JSONWebKey) UnmarshalJSON(data []byte) (err error) { +// +// Directly unmarshaling a JWK is not safe for untrusted input. +func (k *JSONWebKey) UnmarshalJSON(data []byte) error { + return k.unmarshalJSON(data, true) +} + +// unmarshalJSON reads a key from its JSON representation. +// +// If allowPrivate is false, a JWK with private key material is rejected and the +// function is safe for use against untrusted input. +func (k *JSONWebKey) unmarshalJSON(data []byte, allowPrivate bool) (err error) { var raw rawJSONWebKey err = json.Unmarshal(data, &raw) if err != nil { return err } + if !allowPrivate && + (raw.K != nil || raw.D != nil || raw.P != nil || raw.Q != nil || + raw.Dp != nil || raw.Dq != nil || raw.Qi != nil) { + return errors.New("go-jose/go-jose: JWK contains private parameters") + } + certs, err := parseCertificateChain(raw.X5c) if err != nil { return fmt.Errorf("go-jose/go-jose: failed to unmarshal x5c field: %s", err) @@ -505,13 +521,25 @@ func (k *JSONWebKey) Valid() bool { return true } +// MaxRSAModulusBits is the largest RSA modulus size, in bits, that will be +// accepted when parsing a JWK. Applications that need larger keys can raise +// this limit. +// +// If modifying MaxRSAModulusBits, do it before any parsing occurs. +var MaxRSAModulusBits = 4096 + func (key rawJSONWebKey) rsaPublicKey() (*rsa.PublicKey, error) { if key.N == nil || key.E == nil { return nil, fmt.Errorf("go-jose/go-jose: invalid RSA key, missing n/e values") } + n := key.N.bigInt() + if n.BitLen() > MaxRSAModulusBits { + return nil, fmt.Errorf("go-jose/go-jose: invalid RSA key, modulus too large") + } + return &rsa.PublicKey{ - N: key.N.bigInt(), + N: n, E: key.E.toInt(), }, nil } @@ -673,16 +701,23 @@ func (key rawJSONWebKey) rsaPrivateKey() (*rsa.PrivateKey, error) { return nil, fmt.Errorf("go-jose/go-jose: invalid RSA private key, missing %s value(s)", strings.Join(missing, ", ")) } + n := key.N.bigInt() + if n.BitLen() > MaxRSAModulusBits { + return nil, fmt.Errorf("go-jose/go-jose: invalid RSA key, modulus too large") + } + + p, q := key.P.bigInt(), key.Q.bigInt() + if p.BitLen()+q.BitLen() > n.BitLen()+1 || new(big.Int).Mul(p, q).Cmp(n) != 0 { + return nil, errors.New("go-jose/go-jose: invalid RSA private key, p * q != n") + } + rv := &rsa.PrivateKey{ PublicKey: rsa.PublicKey{ - N: key.N.bigInt(), + N: n, E: key.E.toInt(), }, - D: key.D.bigInt(), - Primes: []*big.Int{ - key.P.bigInt(), - key.Q.bigInt(), - }, + D: key.D.bigInt(), + Primes: []*big.Int{p, q}, } if key.Dp != nil { diff --git a/vendor/github.com/go-jose/go-jose/v4/jws.go b/vendor/github.com/go-jose/go-jose/v4/jws.go index 0444a5da05cd..18224df7d92e 100644 --- a/vendor/github.com/go-jose/go-jose/v4/jws.go +++ b/vendor/github.com/go-jose/go-jose/v4/jws.go @@ -275,17 +275,18 @@ func (parsed *rawJSONWebSignature) sanitized(signatureAlgorithms []SignatureAlgo Signature: parsed.Signature, } + mergedHeaders := signature.mergedHeaders() + alg := mergedHeaders.getSignatureAlgorithm() + if !containsSignatureAlgorithm(signatureAlgorithms, alg) { + return nil, newErrUnexpectedSignatureAlgorithm(alg, signatureAlgorithms) + } + var err error - signature.Header, err = signature.mergedHeaders().sanitized() + signature.Header, err = mergedHeaders.sanitized() if err != nil { return nil, err } - alg := SignatureAlgorithm(signature.Header.Algorithm) - if !containsSignatureAlgorithm(signatureAlgorithms, alg) { - return nil, newErrUnexpectedSignatureAlgorithm(alg, signatureAlgorithms) - } - if signature.header != nil { signature.Unprotected, err = signature.header.sanitized() if err != nil { @@ -323,17 +324,20 @@ func (parsed *rawJSONWebSignature) sanitized(signatureAlgorithms []SignatureAlgo return nil, ErrUnprotectedNonce } - var err error - obj.Signatures[i].Header, err = obj.Signatures[i].mergedHeaders().sanitized() - if err != nil { - return nil, err - } + obj.Signatures[i].header = sig.Header - alg := SignatureAlgorithm(obj.Signatures[i].Header.Algorithm) + mergedHeaders := obj.Signatures[i].mergedHeaders() + alg := mergedHeaders.getSignatureAlgorithm() if !containsSignatureAlgorithm(signatureAlgorithms, alg) { return nil, newErrUnexpectedSignatureAlgorithm(alg, signatureAlgorithms) } + var err error + obj.Signatures[i].Header, err = mergedHeaders.sanitized() + if err != nil { + return nil, err + } + if obj.Signatures[i].header != nil { obj.Signatures[i].Unprotected, err = obj.Signatures[i].header.sanitized() if err != nil { @@ -359,7 +363,6 @@ func (parsed *rawJSONWebSignature) sanitized(signatureAlgorithms []SignatureAlgo // Copy value of sig original := sig - obj.Signatures[i].header = sig.Header obj.Signatures[i].original = &original } diff --git a/vendor/github.com/go-jose/go-jose/v4/jwt/errors.go b/vendor/github.com/go-jose/go-jose/v4/jwt/errors.go index 27388e5449a6..b7e1e4bfbb1d 100644 --- a/vendor/github.com/go-jose/go-jose/v4/jwt/errors.go +++ b/vendor/github.com/go-jose/go-jose/v4/jwt/errors.go @@ -47,7 +47,7 @@ var ErrNotValidYet = errors.New("go-jose/go-jose/jwt: validation failed, token n var ErrExpired = errors.New("go-jose/go-jose/jwt: validation failed, token is expired (exp)") // ErrIssuedInTheFuture indicates that the iat field is in the future. -var ErrIssuedInTheFuture = errors.New("go-jose/go-jose/jwt: validation field, token issued in the future (iat)") +var ErrIssuedInTheFuture = errors.New("go-jose/go-jose/jwt: validation failed, token issued in the future (iat)") // ErrInvalidContentType indicates that token requires JWT cty header. var ErrInvalidContentType = errors.New("go-jose/go-jose/jwt: expected content type to be JWT (cty header)") diff --git a/vendor/github.com/go-jose/go-jose/v4/shared.go b/vendor/github.com/go-jose/go-jose/v4/shared.go index 3df242ca6a4c..1e8bf88210e6 100644 --- a/vendor/github.com/go-jose/go-jose/v4/shared.go +++ b/vendor/github.com/go-jose/go-jose/v4/shared.go @@ -297,9 +297,10 @@ func (parsed rawHeader) getEPK() (*JSONWebKey, error) { if v == nil { return nil, nil } - var epk *JSONWebKey - err := json.Unmarshal(*v, &epk) - if err != nil { + // RFC 7518 Section 4.6.1.1: the "epk" header is the ephemeral public key + // of the originator. Reject private key material before parsing it. + epk := new(JSONWebKey) + if err := epk.unmarshalJSON(*v, false); err != nil { return nil, err } return epk, nil @@ -325,20 +326,6 @@ func (parsed rawHeader) getTag() (*byteBuffer, error) { return parsed.getByteBuffer(headerTag) } -// getJWK extracts parsed "jwk" from the raw JSON. -func (parsed rawHeader) getJWK() (*JSONWebKey, error) { - v := parsed[headerJWK] - if v == nil { - return nil, nil - } - var jwk *JSONWebKey - err := json.Unmarshal(*v, &jwk) - if err != nil { - return nil, err - } - return jwk, nil -} - // getCritical extracts parsed "crit" from the raw JSON. If omitted, it // returns an empty slice. func (parsed rawHeader) getCritical() ([]string, error) { @@ -424,10 +411,14 @@ func (parsed rawHeader) sanitized() (h Header, err error) { } switch k { case headerJWK: - var jwk *JSONWebKey - err = json.Unmarshal(*v, &jwk) + // RFC 7515 Section 4.1.3 and RFC 7516 Section 4.1.5: the "jwk" + // header is the public key that corresponds to the key used to + // sign the JWS or encrypt the JWE. Reject private key material + // before parsing it. + jwk := new(JSONWebKey) + err = jwk.unmarshalJSON(*v, false) if err != nil { - err = fmt.Errorf("failed to unmarshal JWK: %v: %#v", err, string(*v)) + err = fmt.Errorf("failed to unmarshal JWK: %w", err) return } h.JSONWebKey = jwk diff --git a/vendor/github.com/go-jose/go-jose/v4/tests.Containerfile b/vendor/github.com/go-jose/go-jose/v4/tests.Containerfile new file mode 100644 index 000000000000..b45da99bd2a4 --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/tests.Containerfile @@ -0,0 +1,13 @@ +# This containerfile can be used to run the go-jose tests and cli + +FROM golang:1.27-trixie +ENV GOTOOLCHAIN=local + +COPY . /src +WORKDIR /src + +# Install the jose-util cli, which will also build the library +RUN go build -o /usr/local/bin/jose-util ./jose-util + +# By default, run the tests +CMD ["go", "test", "./..."] diff --git a/vendor/github.com/go-jose/go-jose/v4/threat_model.md b/vendor/github.com/go-jose/go-jose/v4/threat_model.md new file mode 100644 index 000000000000..c9e66d4c2058 --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/threat_model.md @@ -0,0 +1,25 @@ +# Threat model + +## What this project does and where untrusted input enters +go-jose is a Go implementation of JOSE family of algorithms. + +It is a library which will parse attacker-controlled data in network-reachable +services. + +## Components that matter most / least +The primary attack surface of interest is parsing and validating JWS, JWE, JWK, +etc when this library is used to implement authentication and authorization. + +## How to exercise it +Testing is primarily done by Golang unit tests, which can be run with the +tests.Container file's default CMD. + +## How you rate severity +Any authentication bypass enabled by a go-jose issue is a high+ severity. + +Denial-of-service attacks are of interest when the functions may be used in a protocol like OIDC, ACME, etc +which could have a server processing attacker-controlled data. + +## Anything to leave alone +Any bug which only affects the jose-util CLI tool, but it can be used to exercise the library. + diff --git a/vendor/modules.txt b/vendor/modules.txt index 622cc56e974c..2f9d0c6c9c0c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -93,7 +93,7 @@ github.com/felixge/httpsnoop # github.com/fvbommel/sortorder v1.2.1 ## explicit; go 1.21 github.com/fvbommel/sortorder -# github.com/go-jose/go-jose/v4 v4.1.5 +# github.com/go-jose/go-jose/v4 v4.1.6 ## explicit; go 1.24.0 github.com/go-jose/go-jose/v4 github.com/go-jose/go-jose/v4/cipher From bfb5814dd5e4eccbd915918a3be3ecac88784534 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 3 Nov 2026 11:39:10 +0100 Subject: [PATCH 14/25] bump version to v29.9.3 Signed-off-by: Sebastiaan van Stijn --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index c779e025f075..aa8517ded74a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -29.9.2 +29.9.3 From a4971d1f6023d598a794eb64ba7afed4d2f10657 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 3 Nov 2026 11:54:24 +0100 Subject: [PATCH 15/25] vendor: go.yaml.in/yaml/v3 v3.0.6 resolve: hint-class literal merge-key string "<<" so it's quoted on encode full diff: https://github.com/yaml/go-yaml/compare/v3.0.5...v3.0.6 Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 796f9633b4f3f1b6264b07de5eb651be758ee172) Signed-off-by: Sebastiaan van Stijn --- vendor.mod | 2 +- vendor.sum | 4 ++-- vendor/go.yaml.in/yaml/v3/resolve.go | 1 + vendor/modules.txt | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/vendor.mod b/vendor.mod index 9b14b2e61eb9..d86d30e8d3da 100644 --- a/vendor.mod +++ b/vendor.mod @@ -60,7 +60,7 @@ require ( go.opentelemetry.io/otel/sdk v1.46.0 go.opentelemetry.io/otel/sdk/metric v1.46.0 go.opentelemetry.io/otel/trace v1.46.0 - go.yaml.in/yaml/v3 v3.0.5 + go.yaml.in/yaml/v3 v3.0.6 golang.org/x/sync v0.23.0 golang.org/x/sys v0.48.0 golang.org/x/term v0.46.0 diff --git a/vendor.sum b/vendor.sum index aa0e5e45f982..d6f2bb63c19f 100644 --- a/vendor.sum +++ b/vendor.sum @@ -180,8 +180,8 @@ go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT7 go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= -go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= +go.yaml.in/yaml/v3 v3.0.6 h1:zcDfvjXEqTQmpjniUBLc91xYJMB2c4QOFxEF/LCEckM= +go.yaml.in/yaml/v3 v3.0.6/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= diff --git a/vendor/go.yaml.in/yaml/v3/resolve.go b/vendor/go.yaml.in/yaml/v3/resolve.go index 64ae888057a5..d47f50e64fd6 100644 --- a/vendor/go.yaml.in/yaml/v3/resolve.go +++ b/vendor/go.yaml.in/yaml/v3/resolve.go @@ -42,6 +42,7 @@ func init() { for _, c := range "yYnNtTfFoO~" { t[int(c)] = 'M' // In map } + t[int('<')] = 'M' // In map (merge key "<<") t[int('.')] = '.' // Float (potentially in map) var resolveMapList = []struct { diff --git a/vendor/modules.txt b/vendor/modules.txt index b1024ee9737b..20f3145d1372 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -388,7 +388,7 @@ go.opentelemetry.io/proto/otlp/common/v1 go.opentelemetry.io/proto/otlp/metrics/v1 go.opentelemetry.io/proto/otlp/resource/v1 go.opentelemetry.io/proto/otlp/trace/v1 -# go.yaml.in/yaml/v3 v3.0.5 +# go.yaml.in/yaml/v3 v3.0.6 ## explicit; go 1.16 go.yaml.in/yaml/v3 # golang.org/x/mod v0.41.0 From bb485bc9006f5845c892d34ef138d5d14a282d82 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 3 Nov 2026 12:22:41 +0100 Subject: [PATCH 16/25] vendor: github.com/go-jose/go-jose/v4 v4.1.7 Fixed Security Issues - Thumbprint: reject invalid RSA key [GHSA-r39w-98wm-9pp6] - json: backport stdlib fix for embedded unexported field [GHSA-27pc-rm86-68pq] - Detect if headers are set by presence in the map [GHSA-p9j4-2j95-j4rv] - limit RSA size in certificate verify [GHSA-v6h2-qj3f-2h6v] - Limit recipients and signatures in JWE/JWS [GHSA-c67m-wr4h-2ccg] Fixed - jwk: fix bug in x5c parsing - reject base64-encoded "null" in protected headers Deprecated - deprecate ParseEncrypted / ParseSigned full diff: https://github.com/go-jose/go-jose/compare/v4.1.6...v4.1.7 [GHSA-r39w-98wm-9pp6]: https://github.com/go-jose/go-jose/security/advisories/GHSA-r39w-98wm-9pp6 [GHSA-27pc-rm86-68pq]: https://github.com/go-jose/go-jose/security/advisories/GHSA-27pc-rm86-68pq [GHSA-p9j4-2j95-j4rv]: https://github.com/go-jose/go-jose/security/advisories/GHSA-p9j4-2j95-j4rv [GHSA-v6h2-qj3f-2h6v]: https://github.com/go-jose/go-jose/security/advisories/GHSA-v6h2-qj3f-2h6v [GHSA-c67m-wr4h-2ccg]: https://github.com/go-jose/go-jose/security/advisories/GHSA-c67m-wr4h-2ccg Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 81e4a109a3095ea5ec531b8540ef960376b95287) Signed-off-by: Sebastiaan van Stijn --- vendor.mod | 2 +- vendor.sum | 4 +- .../github.com/go-jose/go-jose/v4/crypter.go | 21 ++++- .../github.com/go-jose/go-jose/v4/encoding.go | 38 ++------- .../go-jose/go-jose/v4/json/decode.go | 13 +++ .../go-jose/go-jose/v4/json/encode.go | 14 +++- vendor/github.com/go-jose/go-jose/v4/jwe.go | 70 ++++++++++++---- vendor/github.com/go-jose/go-jose/v4/jwk.go | 65 ++++++++------ vendor/github.com/go-jose/go-jose/v4/jws.go | 84 ++++++++++++++----- .../github.com/go-jose/go-jose/v4/jwt/jwt.go | 29 +++---- .../github.com/go-jose/go-jose/v4/shared.go | 49 +++++++---- .../github.com/go-jose/go-jose/v4/signing.go | 5 +- .../go-jose/go-jose/v4/symmetric.go | 2 +- vendor/modules.txt | 2 +- 14 files changed, 259 insertions(+), 139 deletions(-) diff --git a/vendor.mod b/vendor.mod index 6aec77110fc7..3f0625ee8706 100644 --- a/vendor.mod +++ b/vendor.mod @@ -25,7 +25,7 @@ require ( github.com/docker/go-connections v0.8.2 github.com/docker/go-units v0.5.0 github.com/fvbommel/sortorder v1.2.1 - github.com/go-jose/go-jose/v4 v4.1.6 + github.com/go-jose/go-jose/v4 v4.1.7 github.com/go-viper/mapstructure/v2 v2.5.0 github.com/gogo/protobuf v1.3.2 github.com/google/go-cmp v0.7.0 diff --git a/vendor.sum b/vendor.sum index b457dc8462b7..c65b39e81e4e 100644 --- a/vendor.sum +++ b/vendor.sum @@ -51,8 +51,8 @@ github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeO github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE= github.com/fvbommel/sortorder v1.2.1 h1:ASc85RbthwLEqzuiCk7WQQiopfyGWQiEYZVJ3Qa4A+U= github.com/fvbommel/sortorder v1.2.1/go.mod h1:LbhO04ijZIeUuvz9B9BkI/qYrpZZEn1gWhxv4QjUKVs= -github.com/go-jose/go-jose/v4 v4.1.6 h1:sNRkftxFJxwsILiQukqp5z83QBSmntVwmgRY7AqBDO4= -github.com/go-jose/go-jose/v4 v4.1.6/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= +github.com/go-jose/go-jose/v4 v4.1.7 h1:Nac/98uT5LPkfbiFuYa8ktf62a2VxwQ4xbq1GK8pV5E= +github.com/go-jose/go-jose/v4 v4.1.7/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= diff --git a/vendor/github.com/go-jose/go-jose/v4/crypter.go b/vendor/github.com/go-jose/go-jose/v4/crypter.go index 53636c57b335..c766539115dd 100644 --- a/vendor/github.com/go-jose/go-jose/v4/crypter.go +++ b/vendor/github.com/go-jose/go-jose/v4/crypter.go @@ -408,7 +408,10 @@ func (ctx *genericEncrypter) EncryptWithAuthData(plaintext, aad []byte) (*JSONWe (*obj.protected)[k] = makeRawMessage(b) } - authData := obj.computeAuthData() + authData, err := obj.computeAuthData() + if err != nil { + return nil, err + } parts, err := ctx.cipher.encrypt(cek, authData, plaintext) if err != nil { return nil, err @@ -492,7 +495,10 @@ func (obj JSONWebEncryption) Decrypt(decryptionKey interface{}) ([]byte, error) tag: obj.tag, } - authData := obj.computeAuthData() + authData, err := obj.computeAuthData() + if err != nil { + return nil, err + } var plaintext []byte recipient := obj.recipients[0] @@ -531,6 +537,12 @@ func (obj JSONWebEncryption) Decrypt(decryptionKey interface{}) ([]byte, error) // // Automatically decompresses plaintext, but returns an error if the decompressed // data would be >250kB or >3x the size of the compressed data, whichever is larger. +// +// Calling DecryptMulti() with PBES2 enabled can result in excessive CPU work. +// The PBES2 key unwrapping algorithms are intentionally expensive, and have to +// be run for each recipient. To be safe: don't allow PBES2 algorithms in calls +// to ParseEncrypted / ParseEncryptedJSON. If your application requires PBES2, +// prefer Decrypt(), which will only process single-recipient messages. func (obj JSONWebEncryption) DecryptMulti(decryptionKey interface{}) (int, Header, []byte, error) { globalHeaders := obj.mergedHeaders(nil) @@ -564,7 +576,10 @@ func (obj JSONWebEncryption) DecryptMulti(decryptionKey interface{}) (int, Heade tag: obj.tag, } - authData := obj.computeAuthData() + authData, err := obj.computeAuthData() + if err != nil { + return -1, Header{}, nil, err + } index := -1 var plaintext []byte diff --git a/vendor/github.com/go-jose/go-jose/v4/encoding.go b/vendor/github.com/go-jose/go-jose/v4/encoding.go index 4f6e0d4a5cf6..34f5501a7486 100644 --- a/vendor/github.com/go-jose/go-jose/v4/encoding.go +++ b/vendor/github.com/go-jose/go-jose/v4/encoding.go @@ -30,30 +30,6 @@ import ( "github.com/go-jose/go-jose/v4/json" ) -// Helper function to serialize known-good objects. -// Precondition: value is not a nil pointer. -func mustSerializeJSON(value interface{}) []byte { - out, err := json.Marshal(value) - if err != nil { - panic(err) - } - // We never want to serialize the top-level value "null," since it's not a - // valid JOSE message. But if a caller passes in a nil pointer to this method, - // MarshalJSON will happily serialize it as the top-level value "null". If - // that value is then embedded in another operation, for instance by being - // base64-encoded and fed as input to a signing algorithm - // (https://github.com/go-jose/go-jose/issues/22), the result will be - // incorrect. Because this method is intended for known-good objects, and a nil - // pointer is not a known-good object, we are free to panic in this case. - // Note: It's not possible to directly check whether the data pointed at by an - // interface is a nil pointer, so we do this hacky workaround. - // https://groups.google.com/forum/#!topic/golang-nuts/wnH302gBa4I - if string(out) == "null" { - panic("Tried to serialize a nil pointer.") - } - return out -} - // Strip all newlines and whitespace func stripWhitespace(data string) string { buf := strings.Builder{} @@ -122,6 +98,8 @@ func inflate(input []byte) ([]byte, error) { } // byteBuffer represents a slice of bytes that can be serialized to url-safe base64. +// +// A nil byteBuffer represents an empty slice of bytes. type byteBuffer struct { data []byte } @@ -169,13 +147,13 @@ func (b *byteBuffer) UnmarshalJSON(data []byte) error { return err } - *b = *newBuffer(decoded) + b.data = decoded return nil } func (b *byteBuffer) base64() string { - return base64.RawURLEncoding.EncodeToString(b.data) + return base64.RawURLEncoding.EncodeToString(b.bytes()) } func (b *byteBuffer) bytes() []byte { @@ -186,12 +164,8 @@ func (b *byteBuffer) bytes() []byte { return b.data } -func (b byteBuffer) bigInt() *big.Int { - return new(big.Int).SetBytes(b.data) -} - -func (b byteBuffer) toInt() int { - return int(b.bigInt().Int64()) +func (b *byteBuffer) bigInt() *big.Int { + return new(big.Int).SetBytes(b.bytes()) } func base64EncodeLen(sl []byte) int { diff --git a/vendor/github.com/go-jose/go-jose/v4/json/decode.go b/vendor/github.com/go-jose/go-jose/v4/json/decode.go index 50634dd84781..6c5e74042008 100644 --- a/vendor/github.com/go-jose/go-jose/v4/json/decode.go +++ b/vendor/github.com/go-jose/go-jose/v4/json/decode.go @@ -671,6 +671,19 @@ func (d *decodeState) object(v reflect.Value) { for _, i := range f.index { if subv.Kind() == reflect.Ptr { if subv.IsNil() { + // If a struct embeds a pointer to an unexported type, + // it is not possible to set a newly allocated value + // since the field is unexported. + // + // See https://golang.org/issue/21357 + if !subv.CanSet() { + d.saveError(fmt.Errorf("json: cannot set embedded pointer to unexported struct: %v", subv.Type().Elem())) + // Invalidate subv to ensure d.value(subv) skips over + // the JSON value without assigning it to subv. + subv = reflect.Value{} + destring = false + break + } subv.Set(reflect.New(subv.Type().Elem())) } subv = subv.Elem() diff --git a/vendor/github.com/go-jose/go-jose/v4/json/encode.go b/vendor/github.com/go-jose/go-jose/v4/json/encode.go index 98de68ce1e9b..fd77790cd3f3 100644 --- a/vendor/github.com/go-jose/go-jose/v4/json/encode.go +++ b/vendor/github.com/go-jose/go-jose/v4/json/encode.go @@ -1025,7 +1025,19 @@ func typeFields(t reflect.Type) []field { // Scan f.typ for fields to include. for i := 0; i < f.typ.NumField(); i++ { sf := f.typ.Field(i) - if sf.PkgPath != "" && !sf.Anonymous { // unexported + if sf.Anonymous { + t := sf.Type + if t.Kind() == reflect.Pointer { + t = t.Elem() + } + if !sf.IsExported() && t.Kind() != reflect.Struct { + // Ignore embedded fields of unexported non-struct types. + continue + } + // Do not ignore embedded fields of unexported struct types + // since they may have exported fields. + } else if !sf.IsExported() { + // Ignore unexported non-embedded fields. continue } tag := sf.Tag.Get("json") diff --git a/vendor/github.com/go-jose/go-jose/v4/jwe.go b/vendor/github.com/go-jose/go-jose/v4/jwe.go index a5169010787d..9b0345695044 100644 --- a/vendor/github.com/go-jose/go-jose/v4/jwe.go +++ b/vendor/github.com/go-jose/go-jose/v4/jwe.go @@ -25,6 +25,12 @@ import ( "github.com/go-jose/go-jose/v4/json" ) +// MaxRecipients is the maximum number of recipients of a JWE at parse time. +// Higher values mean more potential work done across untrusted input. +// +// If modifying MaxRecipients, do it before any parsing occurs. +var MaxRecipients = 32 + // rawJSONWebEncryption represents a raw JWE JSON object. Used for parsing/serializing. type rawJSONWebEncryption struct { Protected *byteBuffer `json:"protected,omitempty"` @@ -84,14 +90,18 @@ func (obj JSONWebEncryption) mergedHeaders(recipient *recipientInfo) rawHeader { } // Get the additional authenticated data from a JWE object. -func (obj JSONWebEncryption) computeAuthData() []byte { +func (obj JSONWebEncryption) computeAuthData() ([]byte, error) { var protected string switch { case obj.original != nil && obj.original.Protected != nil: protected = obj.original.Protected.base64() case obj.protected != nil: - protected = base64.RawURLEncoding.EncodeToString(mustSerializeJSON((obj.protected))) + serializedProtected, err := json.Marshal(obj.protected) + if err != nil { + return nil, err + } + protected = base64.RawURLEncoding.EncodeToString(serializedProtected) default: protected = "" } @@ -102,7 +112,7 @@ func (obj JSONWebEncryption) computeAuthData() []byte { output = append(output, []byte(base64.RawURLEncoding.EncodeToString(obj.aad))...) } - return output + return output, nil } func containsKeyAlgorithm(haystack []KeyAlgorithm, needle KeyAlgorithm) bool { @@ -128,11 +138,10 @@ func containsContentEncryption(haystack []ContentEncryption, needle ContentEncry // https://datatracker.ietf.org/doc/html/rfc7516#section-3.1 // https://datatracker.ietf.org/doc/html/rfc7516#section-3.2 // -// The keyAlgorithms and contentEncryption parameters are used to validate the "alg" and "enc" -// header parameters respectively. They must be nonempty, and each "alg" or "enc" header in -// parsed data must contain a value that is present in the corresponding parameter. That -// includes the protected and unprotected headers as well as all recipients. To accept -// multiple algorithms, pass a slice of all the algorithms you want to accept. +// The keyAlgorithms and contentEncryption parameters contain the allowable algorithms in the "alg" and "enc" +// header parameters respectively. They must be non-empty. Non-matching algorithms cause a parse error. +// +// Deprecated: use ParseEncryptedJSON or ParseEncryptedCompact depending on which serialization you expect. func ParseEncrypted(input string, keyEncryptionAlgorithms []KeyAlgorithm, contentEncryption []ContentEncryption, @@ -145,9 +154,13 @@ func ParseEncrypted(input string, return ParseEncryptedCompact(input, keyEncryptionAlgorithms, contentEncryption) } -// ParseEncryptedJSON parses a message in JWE JSON Serialization. +// ParseEncryptedJSON parses a message in JWE JSON Serialization. Messages with +// more than [MaxRecipients] recipients are rejected. // // https://datatracker.ietf.org/doc/html/rfc7516#section-3.2 +// +// The keyAlgorithms and contentEncryption parameters contain the allowable algorithms in the "alg" and "enc" +// header parameters respectively. They must be non-empty. Any non-allowed algorithms will cause parsing to fail. func ParseEncryptedJSON( input string, keyEncryptionAlgorithms []KeyAlgorithm, @@ -177,6 +190,9 @@ func (parsed *rawJSONWebEncryption) sanitized( if len(contentEncryption) == 0 { return nil, errors.New("go-jose/go-jose: no content encryption algorithms provided") } + if len(parsed.Recipients) > MaxRecipients { + return nil, fmt.Errorf("go-jose/go-jose: too many recipients in JWE; maximum is %d", MaxRecipients) + } obj := &JSONWebEncryption{ original: parsed, @@ -195,12 +211,11 @@ func (parsed *rawJSONWebEncryption) sanitized( } } - if parsed.Protected != nil && len(parsed.Protected.bytes()) > 0 { - err := json.Unmarshal(parsed.Protected.bytes(), &obj.protected) - if err != nil { - return nil, fmt.Errorf("go-jose/go-jose: invalid protected header: %s, %s", err, parsed.Protected.base64()) - } + protected, err := parseProtectedHeader(parsed.Protected) + if err != nil { + return nil, err } + obj.protected = protected if len(parsed.Recipients) == 0 { obj.recipients = []recipientInfo{ @@ -258,7 +273,6 @@ func (parsed *rawJSONWebEncryption) sanitized( // Note: this must be called _after_ we parse the protected header, // otherwise fields from the protected header will not get picked up. mergedHeaders := obj.mergedHeaders(nil) - var err error obj.Header, err = mergedHeaders.sanitized() if err != nil { return nil, fmt.Errorf("go-jose/go-jose: cannot sanitize merged headers: %w", err) @@ -287,6 +301,9 @@ func validateAlgEnc(headers rawHeader, keyAlgorithms []KeyAlgorithm, contentEncr // ParseEncryptedCompact parses a message in JWE Compact Serialization. // // https://datatracker.ietf.org/doc/html/rfc7516#section-3.1 +// +// The keyAlgorithms and contentEncryption parameters contain the allowable algorithms in the "alg" and "enc" +// header parameters respectively. They must be non-empty. Any non-allowed algorithms will cause parsing to fail. func ParseEncryptedCompact( input string, keyAlgorithms []KeyAlgorithm, @@ -354,7 +371,10 @@ func (obj JSONWebEncryption) CompactSerialize() (string, error) { return "", ErrNotSupported } - serializedProtected := mustSerializeJSON(obj.protected) + serializedProtected, err := json.Marshal(obj.protected) + if err != nil { + return "", err + } return base64JoinWithDots( serializedProtected, @@ -366,7 +386,13 @@ func (obj JSONWebEncryption) CompactSerialize() (string, error) { } // FullSerialize serializes an object using the full JSON serialization format. +// +// It returns "" if obj cannot be serialized, for example if it has no recipients. func (obj JSONWebEncryption) FullSerialize() string { + if len(obj.recipients) == 0 { + return "" + } + raw := rawJSONWebEncryption{ Unprotected: obj.unprotected, Iv: newBuffer(obj.iv), @@ -392,8 +418,16 @@ func (obj JSONWebEncryption) FullSerialize() string { } if obj.protected != nil { - raw.Protected = newBuffer(mustSerializeJSON(obj.protected)) + serializedProtected, err := json.Marshal(obj.protected) + if err != nil { + return "" + } + raw.Protected = newBuffer(serializedProtected) } - return string(mustSerializeJSON(raw)) + out, err := json.Marshal(raw) + if err != nil { + return "" + } + return string(out) } diff --git a/vendor/github.com/go-jose/go-jose/v4/jwk.go b/vendor/github.com/go-jose/go-jose/v4/jwk.go index 8b7aa05ec2ba..87acb2c5e1bf 100644 --- a/vendor/github.com/go-jose/go-jose/v4/jwk.go +++ b/vendor/github.com/go-jose/go-jose/v4/jwk.go @@ -30,6 +30,7 @@ import ( "encoding/hex" "errors" "fmt" + "math" "math/big" "net/url" "reflect" @@ -249,7 +250,7 @@ func (k *JSONWebKey) unmarshalJSON(data []byte, allowPrivate bool) (err error) { keyPub = key } case "oct": - if certPub != nil { + if len(certs) > 0 { return errors.New("go-jose/go-jose: invalid JWK, found 'oct' (symmetric) key with cert chain") } key, err = raw.symmetricKey() @@ -288,10 +289,8 @@ func (k *JSONWebKey) unmarshalJSON(data []byte, allowPrivate bool) (err error) { return ErrUnsupportedKeyType } - if certPub != nil && keyPub != nil { - if !reflect.DeepEqual(certPub, keyPub) { - return errors.New("go-jose/go-jose: invalid JWK, public keys in key and x5c fields do not match") - } + if len(certs) > 0 && (certPub == nil || !reflect.DeepEqual(certPub, keyPub)) { + return errors.New("go-jose/go-jose: invalid JWK, public keys in key and x5c fields do not match") } *k = JSONWebKey{Key: key, KeyID: raw.Kid, Algorithm: raw.Alg, Use: raw.Use, Certificates: certs} @@ -408,6 +407,9 @@ func ecThumbprintInput(curve elliptic.Curve, x, y *big.Int) (string, error) { } func rsaThumbprintInput(n *big.Int, e int) (string, error) { + if n == nil || e <= 0 { + return "", errors.New("go-jose/go-jose: invalid RSA key") + } return fmt.Sprintf(rsaThumbprintTemplate, newBufferFromInt(uint64(e)).base64(), newBuffer(n.Bytes()).base64()), nil @@ -522,25 +524,40 @@ func (k *JSONWebKey) Valid() bool { } // MaxRSAModulusBits is the largest RSA modulus size, in bits, that will be -// accepted when parsing a JWK. Applications that need larger keys can raise -// this limit. +// accepted when parsing a JWK or verifying an x5c certificate chain with +// [Header.Certificates]. Applications that need larger keys can raise this +// limit. // // If modifying MaxRSAModulusBits, do it before any parsing occurs. var MaxRSAModulusBits = 4096 func (key rawJSONWebKey) rsaPublicKey() (*rsa.PublicKey, error) { - if key.N == nil || key.E == nil { + return rsaPublicKey(key.N, key.E) +} + +func rsaPublicKey(N, E *byteBuffer) (*rsa.PublicKey, error) { + if N == nil || E == nil { return nil, fmt.Errorf("go-jose/go-jose: invalid RSA key, missing n/e values") } - n := key.N.bigInt() + n := N.bigInt() if n.BitLen() > MaxRSAModulusBits { return nil, fmt.Errorf("go-jose/go-jose: invalid RSA key, modulus too large") } + e := new(big.Int).SetBytes(E.bytes()) + if !e.IsInt64() { + return nil, fmt.Errorf("go-jose/go-jose: invalid RSA key, bad e value") + } + + eInt64 := e.Int64() + if eInt64 < 2 || eInt64 > math.MaxInt { + return nil, fmt.Errorf("go-jose/go-jose: invalid RSA key, bad e value") + } + return &rsa.PublicKey{ N: n, - E: key.E.toInt(), + E: int(eInt64), }, nil } @@ -584,11 +601,11 @@ func (key rawJSONWebKey) ecPublicKey() (*ecdsa.PublicKey, error) { // The length of this octet string MUST be the full size of a coordinate for // the curve specified in the "crv" parameter. // https://tools.ietf.org/html/rfc7518#section-6.2.1.2 - if curveSize(curve) != len(key.X.data) { + if curveSize(curve) != len(key.X.bytes()) { return nil, fmt.Errorf("go-jose/go-jose: invalid EC public key, wrong length for x") } - if curveSize(curve) != len(key.Y.data) { + if curveSize(curve) != len(key.Y.bytes()) { return nil, fmt.Errorf("go-jose/go-jose: invalid EC public key, wrong length for y") } @@ -701,23 +718,21 @@ func (key rawJSONWebKey) rsaPrivateKey() (*rsa.PrivateKey, error) { return nil, fmt.Errorf("go-jose/go-jose: invalid RSA private key, missing %s value(s)", strings.Join(missing, ", ")) } - n := key.N.bigInt() - if n.BitLen() > MaxRSAModulusBits { - return nil, fmt.Errorf("go-jose/go-jose: invalid RSA key, modulus too large") + pubKey, err := rsaPublicKey(key.N, key.E) + if err != nil { + return nil, err } + n := pubKey.N p, q := key.P.bigInt(), key.Q.bigInt() if p.BitLen()+q.BitLen() > n.BitLen()+1 || new(big.Int).Mul(p, q).Cmp(n) != 0 { return nil, errors.New("go-jose/go-jose: invalid RSA private key, p * q != n") } rv := &rsa.PrivateKey{ - PublicKey: rsa.PublicKey{ - N: n, - E: key.E.toInt(), - }, - D: key.D.bigInt(), - Primes: []*big.Int{p, q}, + PublicKey: *pubKey, + D: key.D.bigInt(), + Primes: []*big.Int{p, q}, } if key.Dp != nil { @@ -730,7 +745,7 @@ func (key rawJSONWebKey) rsaPrivateKey() (*rsa.PrivateKey, error) { rv.Precomputed.Qinv = key.Qi.bigInt() } - err := rv.Validate() + err = rv.Validate() return rv, err } @@ -804,16 +819,16 @@ func (key rawJSONWebKey) ecPrivateKey() (*ecdsa.PrivateKey, error) { // The length of this octet string MUST be the full size of a coordinate for // the curve specified in the "crv" parameter. // https://tools.ietf.org/html/rfc7518#section-6.2.1.2 - if curveSize(curve) != len(key.X.data) { + if curveSize(curve) != len(key.X.bytes()) { return nil, fmt.Errorf("go-jose/go-jose: invalid EC private key, wrong length for x") } - if curveSize(curve) != len(key.Y.data) { + if curveSize(curve) != len(key.Y.bytes()) { return nil, fmt.Errorf("go-jose/go-jose: invalid EC private key, wrong length for y") } // https://tools.ietf.org/html/rfc7518#section-6.2.2.1 - if dSize(curve) != len(key.D.data) { + if dSize(curve) != len(key.D.bytes()) { return nil, fmt.Errorf("go-jose/go-jose: invalid EC private key, wrong length for d") } diff --git a/vendor/github.com/go-jose/go-jose/v4/jws.go b/vendor/github.com/go-jose/go-jose/v4/jws.go index 18224df7d92e..451817a7f77c 100644 --- a/vendor/github.com/go-jose/go-jose/v4/jws.go +++ b/vendor/github.com/go-jose/go-jose/v4/jws.go @@ -27,6 +27,12 @@ import ( "github.com/go-jose/go-jose/v4/json" ) +// MaxSignatures is the maximum number of signatures in a JWS at parse time. +// Higher values mean more potential work done across untrusted input. +// +// If modifying MaxSignatures, do it before any parsing occurs. +var MaxSignatures = 32 + // rawJSONWebSignature represents a raw JWS JSON object. Used for parsing/serializing. type rawJSONWebSignature struct { Payload *byteBuffer `json:"payload,omitempty"` @@ -86,6 +92,11 @@ type Signature struct { // Verify() after parsing to validate the signature and obtain the payload. // // https://datatracker.ietf.org/doc/html/rfc7515#section-7 +// +// The signatureAlgorithms parameter contains the allowable algorithms in the "alg" header parameter. +// It must be non-empty. Non-matching algorithms cause a parse error. +// +// Deprecated: call ParseSignedJSON or ParseSignedCompact depending on which serialization you expect. func ParseSigned( signature string, signatureAlgorithms []SignatureAlgorithm, @@ -108,6 +119,9 @@ func ParseSigned( // Verify() after parsing to validate the signature and obtain the payload. // // https://datatracker.ietf.org/doc/html/rfc7515#section-7.1 +// +// The signatureAlgorithms parameter contains the allowable algorithms in the "alg" header parameter. +// It must be non-empty. Non-matching algorithms cause a parse error. func ParseSignedCompact( signature string, signatureAlgorithms []SignatureAlgorithm, @@ -125,6 +139,9 @@ func ParseSignedCompact( // parsing. Call Verify() after parsing to validate the signature and obtain the payload. // // https://datatracker.ietf.org/doc/html/rfc7515#appendix-F +// +// The signatureAlgorithms parameter contains the allowable algorithms in the "alg" header parameter. +// It must be non-empty. Any non-allowed algorithms will cause parsing to fail. func ParseDetached( signature string, payload []byte, @@ -157,7 +174,11 @@ func (obj JSONWebSignature) computeAuthData(payload []byte, signature *Signature authData.WriteString(signature.original.Protected.base64()) } else if signature.protected != nil { protectedHeader = signature.protected - authData.WriteString(base64.RawURLEncoding.EncodeToString(mustSerializeJSON(protectedHeader))) + serializedProtected, err := json.Marshal(protectedHeader) + if err != nil { + return nil, err + } + authData.WriteString(base64.RawURLEncoding.EncodeToString(serializedProtected)) } needsBase64 := true @@ -180,9 +201,13 @@ func (obj JSONWebSignature) computeAuthData(payload []byte, signature *Signature return authData.Bytes(), nil } -// ParseSignedJSON parses a message in JWS JSON Serialization. +// ParseSignedJSON parses a message in JWS JSON Serialization. Messages with +// more than [MaxSignatures] signatures are rejected. // // https://datatracker.ietf.org/doc/html/rfc7515#section-7.2 +// +// The signatureAlgorithms parameter contains the allowable algorithms in the "alg" header parameter. +// It must be non-empty. Non-matching algorithms cause a parse error. func ParseSignedJSON( input string, signatureAlgorithms []SignatureAlgorithm, @@ -236,6 +261,9 @@ func (parsed *rawJSONWebSignature) sanitized(signatureAlgorithms []SignatureAlgo if parsed.Payload == nil { return nil, fmt.Errorf("go-jose/go-jose: missing payload in JWS message") } + if len(parsed.Signatures) > MaxSignatures { + return nil, fmt.Errorf("go-jose/go-jose: too many signatures in JWS; maximum is %d", MaxSignatures) + } obj := &JSONWebSignature{ payload: parsed.Payload.bytes(), @@ -245,14 +273,13 @@ func (parsed *rawJSONWebSignature) sanitized(signatureAlgorithms []SignatureAlgo if len(parsed.Signatures) == 0 { // No signatures array, must be flattened serialization signature := Signature{} - if parsed.Protected != nil && len(parsed.Protected.bytes()) > 0 { - signature.protected = &rawHeader{} - err := json.Unmarshal(parsed.Protected.bytes(), signature.protected) - if err != nil { - return nil, err - } + prot, err := parseProtectedHeader(parsed.Protected) + if err != nil { + return nil, err } + signature.protected = prot + // Check that there is not a nonce in the unprotected header if parsed.Header != nil && parsed.Header.getNonce() != "" { return nil, ErrUnprotectedNonce @@ -281,7 +308,6 @@ func (parsed *rawJSONWebSignature) sanitized(signatureAlgorithms []SignatureAlgo return nil, newErrUnexpectedSignatureAlgorithm(alg, signatureAlgorithms) } - var err error signature.Header, err = mergedHeaders.sanitized() if err != nil { return nil, err @@ -311,14 +337,13 @@ func (parsed *rawJSONWebSignature) sanitized(signatureAlgorithms []SignatureAlgo } for i, sig := range parsed.Signatures { - if sig.Protected != nil && len(sig.Protected.bytes()) > 0 { - obj.Signatures[i].protected = &rawHeader{} - err := json.Unmarshal(sig.Protected.bytes(), obj.Signatures[i].protected) - if err != nil { - return nil, err - } + prot, err := parseProtectedHeader(sig.Protected) + if err != nil { + return nil, err } + obj.Signatures[i].protected = prot + // Check that there is not a nonce in the unprotected header if sig.Header != nil && sig.Header.getNonce() != "" { return nil, ErrUnprotectedNonce @@ -332,7 +357,6 @@ func (parsed *rawJSONWebSignature) sanitized(signatureAlgorithms []SignatureAlgo return nil, newErrUnexpectedSignatureAlgorithm(alg, signatureAlgorithms) } - var err error obj.Signatures[i].Header, err = mergedHeaders.sanitized() if err != nil { return nil, err @@ -427,7 +451,10 @@ func (obj JSONWebSignature) compactSerialize(detached bool) (string, error) { return "", ErrNotSupported } - serializedProtected := mustSerializeJSON(obj.Signatures[0].protected) + serializedProtected, err := json.Marshal(obj.Signatures[0].protected) + if err != nil { + return "", err + } var payload []byte if !detached { @@ -452,14 +479,23 @@ func (obj JSONWebSignature) DetachedCompactSerialize() (string, error) { } // FullSerialize serializes an object using the full JSON serialization format. +// +// It returns "" if obj cannot be serialized. func (obj JSONWebSignature) FullSerialize() string { raw := rawJSONWebSignature{ Payload: newBuffer(obj.payload), } + if len(obj.Signatures) == 0 { + return "" + } + if len(obj.Signatures) == 1 { if obj.Signatures[0].protected != nil { - serializedProtected := mustSerializeJSON(obj.Signatures[0].protected) + serializedProtected, err := json.Marshal(obj.Signatures[0].protected) + if err != nil { + return "" + } raw.Protected = newBuffer(serializedProtected) } raw.Header = obj.Signatures[0].header @@ -473,10 +509,18 @@ func (obj JSONWebSignature) FullSerialize() string { } if signature.protected != nil { - raw.Signatures[i].Protected = newBuffer(mustSerializeJSON(signature.protected)) + serializedProtected, err := json.Marshal(signature.protected) + if err != nil { + return "" + } + raw.Signatures[i].Protected = newBuffer(serializedProtected) } } } - return string(mustSerializeJSON(raw)) + out, err := json.Marshal(raw) + if err != nil { + return "" + } + return string(out) } diff --git a/vendor/github.com/go-jose/go-jose/v4/jwt/jwt.go b/vendor/github.com/go-jose/go-jose/v4/jwt/jwt.go index c4998d7875dc..30251e6f75e1 100644 --- a/vendor/github.com/go-jose/go-jose/v4/jwt/jwt.go +++ b/vendor/github.com/go-jose/go-jose/v4/jwt/jwt.go @@ -85,7 +85,12 @@ func (t *NestedJSONWebToken) Decrypt(decryptionKey interface{}) (*JSONWebToken, return sig, nil } -// ParseSigned parses token from JWS form. +// ParseSigned parses a JWT in the JWS Compact Serialization. +// +// https://datatracker.ietf.org/doc/html/rfc7515#section-3.1 +// +// The signatureAlgorithms parameter contains the allowable algorithms in the "alg" header parameter. +// It must be non-empty. Non-matching algorithms cause a parse error. func ParseSigned(s string, signatureAlgorithms []jose.SignatureAlgorithm) (*JSONWebToken, error) { sig, err := jose.ParseSignedCompact(s, signatureAlgorithms) if err != nil { @@ -142,13 +147,10 @@ func parseEncryptedCompact( return enc, nil } -// ParseEncrypted parses token from JWE form. +// ParseEncrypted parses a JWT in the JWE Compact Serialization. // -// The keyAlgorithms and contentEncryption parameters are used to validate the "alg" and "enc" -// header parameters respectively. They must be nonempty, and each "alg" or "enc" header in -// parsed data must contain a value that is present in the corresponding parameter. That -// includes the protected and unprotected headers as well as all recipients. To accept -// multiple algorithms, pass a slice of all the algorithms you want to accept. +// The keyAlgorithms and contentEncryption parameters contain the allowable algorithms in the "alg" and "enc" +// header parameters respectively. They must be non-empty. Non-matching algorithms cause a parse error. func ParseEncrypted(s string, keyAlgorithms []jose.KeyAlgorithm, contentEncryption []jose.ContentEncryption, @@ -164,17 +166,10 @@ func ParseEncrypted(s string, }, nil } -// ParseSignedAndEncrypted parses signed-then-encrypted token from JWE form. -// -// The encryptionKeyAlgorithms and contentEncryption parameters are used to validate the "alg" and "enc" -// header parameters, respectively, of the outer JWE. They must be nonempty, and each "alg" or "enc" -// header in parsed data must contain a value that is present in the corresponding parameter. That -// includes the protected and unprotected headers as well as all recipients. To accept -// multiple algorithms, pass a slice of all the algorithms you want to accept. +// ParseSignedAndEncrypted parses a signed-then-encrypted token in the JWE Compact Serialization. // -// The signatureAlgorithms parameter is used to validate the "alg" header parameter of the -// inner JWS. It must be nonempty, and the "alg" header in the inner JWS must contain a value -// that is present in the parameter. +// The encryptionKeyAlgorithms, contentEncryption, and signatureAlgorithms parameters contain the allowable +// algorithms. They must be non-empty. Non-matching algorithms cause a parse error. func ParseSignedAndEncrypted(s string, encryptionKeyAlgorithms []jose.KeyAlgorithm, contentEncryption []jose.ContentEncryption, diff --git a/vendor/github.com/go-jose/go-jose/v4/shared.go b/vendor/github.com/go-jose/go-jose/v4/shared.go index 1e8bf88210e6..7303615a9f07 100644 --- a/vendor/github.com/go-jose/go-jose/v4/shared.go +++ b/vendor/github.com/go-jose/go-jose/v4/shared.go @@ -18,6 +18,7 @@ package jose import ( "crypto/elliptic" + "crypto/rsa" "crypto/x509" "encoding/base64" "errors" @@ -210,13 +211,20 @@ type Header struct { // Certificates verifies & returns the certificate chain present // in the x5c header field of a message, if one was present. Returns -// an error if there was no x5c header present or the chain could +// an error if there was no x5c header present, any certificate in the +// chain has an RSA key larger than [MaxRSAModulusBits], or the chain could // not be validated with the given verify options. func (h Header) Certificates(opts x509.VerifyOptions) ([][]*x509.Certificate, error) { if len(h.certificates) == 0 { return nil, ErrMissingX5cHeader } + for _, cert := range h.certificates { + if pub, ok := cert.PublicKey.(*rsa.PublicKey); ok && pub.N.BitLen() > MaxRSAModulusBits { + return nil, fmt.Errorf("go-jose/go-jose: invalid RSA key in x5c certificate, modulus too large") + } + } + leaf := h.certificates[0] if opts.Intermediates == nil { opts.Intermediates = x509.NewCertPool() @@ -490,22 +498,8 @@ func parseCertificateChain(chain []string) ([]*x509.Certificate, error) { } func (parsed rawHeader) isSet(k HeaderKey) bool { - dvr := parsed[k] - if dvr == nil { - return false - } - - var dv interface{} - err := json.Unmarshal(*dvr, &dv) - if err != nil { - return true - } - - if dvStr, ok := dv.(string); ok { - return dvStr != "" - } - - return true + _, ok := parsed[k] + return ok } // Merge headers from src into dst, giving precedence to headers from l. @@ -555,3 +549,24 @@ func makeRawMessage(b []byte) *json.RawMessage { rm := json.RawMessage(b) return &rm } + +// parseProtectedHeader parses a `byteBuffer` into a `*rawHeader`. +// +// The byteBuffer represents a base64-decoded "protected" header, which +// is specified to contain a JSON object. +// +// If the input is nil or empty, returns `nil, nil`. +// +// `rawHeader` is a map type and so can be nil. When this function +// returns a non-nil `*rawHeader`, the map is guaranteed to be non-nil. +func parseProtectedHeader(in *byteBuffer) (*rawHeader, error) { + if in == nil || len(in.bytes()) == 0 { + return nil, nil + } + var header rawHeader + err := json.Unmarshal(in.bytes(), &header) + if err != nil || header == nil { + return nil, errors.New("go-jose/go-jose: invalid protected header") + } + return &header, nil +} diff --git a/vendor/github.com/go-jose/go-jose/v4/signing.go b/vendor/github.com/go-jose/go-jose/v4/signing.go index 5baf75cb2e84..008cd4a2709e 100644 --- a/vendor/github.com/go-jose/go-jose/v4/signing.go +++ b/vendor/github.com/go-jose/go-jose/v4/signing.go @@ -321,7 +321,10 @@ func (ctx *genericSigner) Sign(payload []byte) (*JSONWebSignature, error) { protected[k] = v } - serializedProtected := mustSerializeJSON(protected) + serializedProtected, err := json.Marshal(protected) + if err != nil { + return nil, fmt.Errorf("go-jose/go-jose: Error marshaling JSON: %s", err) + } needsBase64 := true if b64, ok := protected[headerB64]; ok { diff --git a/vendor/github.com/go-jose/go-jose/v4/symmetric.go b/vendor/github.com/go-jose/go-jose/v4/symmetric.go index ca597d6a1279..3f2a4fdf8514 100644 --- a/vendor/github.com/go-jose/go-jose/v4/symmetric.go +++ b/vendor/github.com/go-jose/go-jose/v4/symmetric.go @@ -421,7 +421,7 @@ func (ctx *symmetricKeyCipher) decryptKey(headers rawHeader, recipient *recipien if err != nil { return nil, fmt.Errorf("go-jose/go-jose: invalid P2S: %v", err) } - if p2s == nil || len(p2s.data) == 0 { + if p2s == nil || len(p2s.bytes()) == 0 { return nil, fmt.Errorf("go-jose/go-jose: invalid P2S: must be present") } diff --git a/vendor/modules.txt b/vendor/modules.txt index dc98316caad9..441bc3c5a36a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -93,7 +93,7 @@ github.com/felixge/httpsnoop # github.com/fvbommel/sortorder v1.2.1 ## explicit; go 1.21 github.com/fvbommel/sortorder -# github.com/go-jose/go-jose/v4 v4.1.6 +# github.com/go-jose/go-jose/v4 v4.1.7 ## explicit; go 1.24.0 github.com/go-jose/go-jose/v4 github.com/go-jose/go-jose/v4/cipher From 64fe50bbea3afc87fb58772cb0cc9335e7c35cba Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 3 Nov 2026 19:21:56 +0100 Subject: [PATCH 17/25] vendor: github.com/moby/swarmkit/v2 v2.1.3 full diff: https://github.com/moby/swarmkit/compare/v2.1.2...v2.1.3 Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 77ebef3df8b198664399811a514abb563940555e) Signed-off-by: Sebastiaan van Stijn --- vendor.mod | 2 +- vendor.sum | 4 +- .../moby/swarmkit/v2/api/api.pb.txt | 69 ++++++++++++++++--- .../moby/swarmkit/v2/api/deepcopy/copy.go | 4 +- .../moby/swarmkit/v2/api/storeobject.go | 4 +- vendor/modules.txt | 4 +- 6 files changed, 69 insertions(+), 18 deletions(-) diff --git a/vendor.mod b/vendor.mod index 3f0625ee8706..46ca2c3f60eb 100644 --- a/vendor.mod +++ b/vendor.mod @@ -36,7 +36,7 @@ require ( github.com/moby/moby/api v1.56.1 github.com/moby/moby/client v0.6.2 github.com/moby/patternmatcher v0.6.1 - github.com/moby/swarmkit/v2 v2.1.2 + github.com/moby/swarmkit/v2 v2.1.3 github.com/moby/sys/atomicwriter v0.1.0 github.com/moby/sys/capability v0.4.0 github.com/moby/sys/sequential v0.7.0 diff --git a/vendor.sum b/vendor.sum index c65b39e81e4e..5cd6715de89d 100644 --- a/vendor.sum +++ b/vendor.sum @@ -94,8 +94,8 @@ github.com/moby/moby/client v0.6.2 h1:ekSPlMccrZGcw6Scb8T9D39qE0mB+XupU/yS0zNw9N github.com/moby/moby/client v0.6.2/go.mod h1:DGcnO7qmPJrqobx/ggQgQ/AUk+2wgVdQv7uxB0/mEsc= github.com/moby/patternmatcher v0.6.1 h1:qlhtafmr6kgMIJjKJMDmMWq7WLkKIo23hsrpR3x084U= github.com/moby/patternmatcher v0.6.1/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= -github.com/moby/swarmkit/v2 v2.1.2 h1:1WDZAI6HVYNKdCG4zlXnTAPyLsLwuhRGWlHoOUf5Z6I= -github.com/moby/swarmkit/v2 v2.1.2/go.mod h1:GQ6T0ij2oBbWX10OHwpvK449xfXkQMZ8J+B+eQ4mgp4= +github.com/moby/swarmkit/v2 v2.1.3 h1:UcwtwkIRjr75qSgUWCTIuzKUzAXlidxsiqVMnyxSF1w= +github.com/moby/swarmkit/v2 v2.1.3/go.mod h1:KhkxT93Hm4wHoNUPJ4JRD384pS7OODFGzJWoDRj9bLE= github.com/moby/sys/atomicwriter v0.1.0 h1:kw5D/EqkBwsBFi0ss9v1VG3wIkVhzGvLklJ+w3A14Sw= github.com/moby/sys/atomicwriter v0.1.0/go.mod h1:Ul8oqv2ZMNHOceF643P6FKPXeCmYtlQMvpizfsSoaWs= github.com/moby/sys/capability v0.4.0 h1:4D4mI6KlNtWMCM1Z/K0i7RV1FkX+DBDHKVJpCndZoHk= diff --git a/vendor/github.com/moby/swarmkit/v2/api/api.pb.txt b/vendor/github.com/moby/swarmkit/v2/api/api.pb.txt index ffa446d07b37..3a27d49007e5 100644 --- a/vendor/github.com/moby/swarmkit/v2/api/api.pb.txt +++ b/vendor/github.com/moby/swarmkit/v2/api/api.pb.txt @@ -22,7 +22,7 @@ file { java_package: "com.google.protobuf" java_outer_classname: "TimestampProto" java_multiple_files: true - go_package: "github.com/golang/protobuf/ptypes/timestamp" + go_package: "google.golang.org/protobuf/types/known/timestamppb" cc_enable_arenas: true objc_class_prefix: "GPB" csharp_namespace: "Google.Protobuf.WellKnownTypes" @@ -53,7 +53,7 @@ file { java_package: "com.google.protobuf" java_outer_classname: "DurationProto" java_multiple_files: true - go_package: "github.com/golang/protobuf/ptypes/duration" + go_package: "google.golang.org/protobuf/types/known/durationpb" cc_enable_arenas: true objc_class_prefix: "GPB" csharp_namespace: "Google.Protobuf.WellKnownTypes" @@ -157,7 +157,7 @@ file { java_package: "com.google.protobuf" java_outer_classname: "WrappersProto" java_multiple_files: true - go_package: "github.com/golang/protobuf/ptypes/wrappers" + go_package: "google.golang.org/protobuf/types/known/wrapperspb" cc_enable_arenas: true objc_class_prefix: "GPB" csharp_namespace: "Google.Protobuf.WellKnownTypes" @@ -484,6 +484,13 @@ file { type_name: ".google.protobuf.FieldOptions" json_name: "options" } + field { + name: "proto3_optional" + number: 17 + label: LABEL_OPTIONAL + type: TYPE_BOOL + json_name: "proto3Optional" + } enum_type { name: "Type" value { @@ -853,7 +860,7 @@ file { number: 31 label: LABEL_OPTIONAL type: TYPE_BOOL - default_value: "false" + default_value: "true" json_name: "ccEnableArenas" } field { @@ -1405,7 +1412,7 @@ file { java_package: "com.google.protobuf" java_outer_classname: "DescriptorProtos" optimize_for: SPEED - go_package: "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor" + go_package: "google.golang.org/protobuf/types/descriptorpb" cc_enable_arenas: true objc_class_prefix: "GPB" csharp_namespace: "Google.Protobuf.Reflection" @@ -5208,7 +5215,7 @@ file { java_package: "com.google.protobuf" java_outer_classname: "AnyProto" java_multiple_files: true - go_package: "github.com/golang/protobuf/ptypes/any" + go_package: "google.golang.org/protobuf/types/known/anypb" objc_class_prefix: "GPB" csharp_namespace: "Google.Protobuf.WellKnownTypes" } @@ -10590,7 +10597,7 @@ file { syntax: "proto3" } file { - name: "go.etcd.io/etcd/raft/v3/raftpb/raft.proto" + name: "go.etcd.io/raft/v3/raftpb/raft.proto" package: "raftpb" dependency: "gogoproto/gogo.proto" message_type { @@ -10773,6 +10780,16 @@ file { } json_name: "commit" } + field { + name: "vote" + number: 13 + label: LABEL_OPTIONAL + type: TYPE_UINT64 + options { + 65001: 0 + } + json_name: "vote" + } field { name: "snapshot" number: 9 @@ -10780,7 +10797,7 @@ file { type: TYPE_MESSAGE type_name: ".raftpb.Snapshot" options { - 65001: 0 + 65001: 1 } json_name: "snapshot" } @@ -10809,8 +10826,22 @@ file { number: 12 label: LABEL_OPTIONAL type: TYPE_BYTES + options { + 65001: 1 + } json_name: "context" } + field { + name: "responses" + number: 14 + label: LABEL_REPEATED + type: TYPE_MESSAGE + type_name: ".raftpb.Message" + options { + 65001: 0 + } + json_name: "responses" + } } message_type { name: "HardState" @@ -11079,6 +11110,26 @@ file { name: "MsgPreVoteResp" number: 18 } + value { + name: "MsgStorageAppend" + number: 19 + } + value { + name: "MsgStorageAppendResp" + number: 20 + } + value { + name: "MsgStorageApply" + number: 21 + } + value { + name: "MsgStorageApplyResp" + number: 22 + } + value { + name: "MsgForgetLeader" + number: 23 + } } enum_type { name: "ConfChangeTransition" @@ -11130,7 +11181,7 @@ file { package: "docker.swarmkit.v1" dependency: "github.com/docker/swarmkit/api/objects.proto" dependency: "github.com/docker/swarmkit/api/types.proto" - dependency: "go.etcd.io/etcd/raft/v3/raftpb/raft.proto" + dependency: "go.etcd.io/raft/v3/raftpb/raft.proto" dependency: "gogoproto/gogo.proto" dependency: "github.com/docker/swarmkit/protobuf/plugin/plugin.proto" message_type { diff --git a/vendor/github.com/moby/swarmkit/v2/api/deepcopy/copy.go b/vendor/github.com/moby/swarmkit/v2/api/deepcopy/copy.go index fd44621f015b..1f9baf794dc1 100644 --- a/vendor/github.com/moby/swarmkit/v2/api/deepcopy/copy.go +++ b/vendor/github.com/moby/swarmkit/v2/api/deepcopy/copy.go @@ -12,7 +12,7 @@ type CopierFrom interface { // Copy takes the fields from src and copies them into the target object. // // Calling this method with a nil receiver or a nil src may panic. - CopyFrom(src interface{}) + CopyFrom(src any) } // Copy copies src into dst. dst and src must have the same type. @@ -24,7 +24,7 @@ type CopierFrom interface { // // If the copy cannot be performed, this function will panic. Make sure to test // types that use this function. -func Copy(dst, src interface{}) { +func Copy(dst, src any) { switch dst := dst.(type) { case *types.Any: src := src.(*types.Any) diff --git a/vendor/github.com/moby/swarmkit/v2/api/storeobject.go b/vendor/github.com/moby/swarmkit/v2/api/storeobject.go index f7e483d97344..c797bc575fe4 100644 --- a/vendor/github.com/moby/swarmkit/v2/api/storeobject.go +++ b/vendor/github.com/moby/swarmkit/v2/api/storeobject.go @@ -73,7 +73,7 @@ func customIndexer(kind string, annotations *Annotations) (bool, [][]byte, error return len(converted) != 0, converted, nil } -func fromArgs(args ...interface{}) ([]byte, error) { +func fromArgs(args ...any) ([]byte, error) { if len(args) != 1 { return nil, fmt.Errorf("must provide only a single argument") } @@ -86,7 +86,7 @@ func fromArgs(args ...interface{}) ([]byte, error) { return []byte(arg), nil } -func prefixFromArgs(args ...interface{}) ([]byte, error) { +func prefixFromArgs(args ...any) ([]byte, error) { val, err := fromArgs(args...) if err != nil { return nil, err diff --git a/vendor/modules.txt b/vendor/modules.txt index 441bc3c5a36a..ff0304467f49 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -205,8 +205,8 @@ github.com/moby/moby/client/pkg/versions ## explicit; go 1.19 github.com/moby/patternmatcher github.com/moby/patternmatcher/ignorefile -# github.com/moby/swarmkit/v2 v2.1.2 -## explicit; go 1.24.0 +# github.com/moby/swarmkit/v2 v2.1.3 +## explicit; go 1.25.0 github.com/moby/swarmkit/v2/api github.com/moby/swarmkit/v2/api/deepcopy github.com/moby/swarmkit/v2/api/defaults From cac50c5e62fa21a65a2f0764753084590215be10 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 3 Nov 2026 22:27:00 +0100 Subject: [PATCH 18/25] vendor: github.com/klauspost/compress v1.20.2 includes a fix for CVE-2026-116591 / [GHSA-fpmh-frq8-7rj8] full diff: https://github.com/klauspost/compress/compare/v1.20.1...v1.20.2 [GHSA-fpmh-frq8-7rj8]: https://github.com/klauspost/compress/security/advisories/GHSA-fpmh-frq8-7rj8 Signed-off-by: Sebastiaan van Stijn (cherry picked from commit b9456fd72510522446d4c3dbf703a9b61ccf9982) Signed-off-by: Sebastiaan van Stijn --- vendor.mod | 2 +- vendor.sum | 4 ++-- vendor/github.com/klauspost/compress/fse/compress.go | 3 ++- .../github.com/klauspost/compress/fse/decompress.go | 6 ++++++ .../klauspost/compress/huff0/decompress.go | 4 ++++ vendor/github.com/klauspost/compress/zstd/dict.go | 3 +++ vendor/github.com/klauspost/compress/zstd/snappy.go | 12 ++++++++++++ vendor/modules.txt | 2 +- 8 files changed, 31 insertions(+), 5 deletions(-) diff --git a/vendor.mod b/vendor.mod index 46ca2c3f60eb..80de6987ed15 100644 --- a/vendor.mod +++ b/vendor.mod @@ -87,7 +87,7 @@ require ( github.com/gorilla/mux v1.8.1 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/klauspost/compress v1.20.1 // indirect + github.com/klauspost/compress v1.20.2 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect github.com/moby/sys/user v0.4.1 // indirect github.com/moby/sys/userns v0.2.1 // indirect diff --git a/vendor.sum b/vendor.sum index 5cd6715de89d..90c1a1b8111d 100644 --- a/vendor.sum +++ b/vendor.sum @@ -78,8 +78,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.20.1 h1:T7kKElXUMXrUJ2E9QhQhxFtcK5rPyLdsGZvdbLMPdiQ= -github.com/klauspost/compress v1.20.1/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= +github.com/klauspost/compress v1.20.2 h1:v5tiZvm1KGLyg5d5oXdXe3lsSPrbEUiKoXGia//I7Qo= +github.com/klauspost/compress v1.20.2/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/mattn/go-runewidth v0.0.31 h1:1oCV4ReTlosDBc6rYRw5cL8S/4y8iv5oRl4SJ5IBgwo= diff --git a/vendor/github.com/klauspost/compress/fse/compress.go b/vendor/github.com/klauspost/compress/fse/compress.go index 8c8baa4fc2c4..2a7cd684ea96 100644 --- a/vendor/github.com/klauspost/compress/fse/compress.go +++ b/vendor/github.com/klauspost/compress/fse/compress.go @@ -659,7 +659,8 @@ func (s *Scratch) validateNorm() (err error) { if v >= 0 { total += int(v) } else { - total -= int(v) + // -1 takes one cell. Adding -v would let a wrapped -32768 pass. + total++ } } defer func() { diff --git a/vendor/github.com/klauspost/compress/fse/decompress.go b/vendor/github.com/klauspost/compress/fse/decompress.go index 0c7dd4ffef9f..85b55db579b4 100644 --- a/vendor/github.com/klauspost/compress/fse/decompress.go +++ b/vendor/github.com/klauspost/compress/fse/decompress.go @@ -3,6 +3,7 @@ package fse import ( "errors" "fmt" + "math" ) const ( @@ -123,6 +124,11 @@ func (s *Scratch) readNCount() error { remaining -= count gotTotal += count } + if count > math.MaxInt16 { + // Only one symbol filling a tableLog 15 table, which cannot be decoded. + // Truncated, it would leave the decoding table unwritten. + return fmt.Errorf("corruption detected (count %d > %d)", count, math.MaxInt16) + } s.norm[charnum&0xff] = int16(count) charnum++ previous0 = count == 0 diff --git a/vendor/github.com/klauspost/compress/huff0/decompress.go b/vendor/github.com/klauspost/compress/huff0/decompress.go index 7d0efa8818a7..4832c960f475 100644 --- a/vendor/github.com/klauspost/compress/huff0/decompress.go +++ b/vendor/github.com/klauspost/compress/huff0/decompress.go @@ -54,6 +54,10 @@ func ReadTable(in []byte, s *Scratch) (s2 *Scratch, remain []byte, err error) { if len(in) < int(iSize) { return s, nil, fmt.Errorf("input too small for table, want %d bytes, have %d", iSize, len(in)) } + // The low nibble is the weights' FSE tableLog - 5, which the format limits to 6. + if in[0]&15+5 > 6 { + return s, nil, errors.New("corrupt input: weights tableLog too big") + } // FSE compressed weights s.fse.DecompressLimit = 255 hw := s.huffWeight[:] diff --git a/vendor/github.com/klauspost/compress/zstd/dict.go b/vendor/github.com/klauspost/compress/zstd/dict.go index 67f40e791490..92ab388c1461 100644 --- a/vendor/github.com/klauspost/compress/zstd/dict.go +++ b/vendor/github.com/klauspost/compress/zstd/dict.go @@ -219,6 +219,9 @@ func BuildDict(o BuildDictOptions) ([]byte, error) { if len(contents) == 0 { return nil, errors.New("no content provided") } + if o.Level < speedNotSet || o.Level >= speedLast { + return nil, fmt.Errorf("unknown encoder level %d", o.Level) + } d := dict{ id: o.ID, litEnc: nil, diff --git a/vendor/github.com/klauspost/compress/zstd/snappy.go b/vendor/github.com/klauspost/compress/zstd/snappy.go index 36c56f36d771..06ed593ea41d 100644 --- a/vendor/github.com/klauspost/compress/zstd/snappy.go +++ b/vendor/github.com/klauspost/compress/zstd/snappy.go @@ -69,6 +69,10 @@ var ( // No CRC value is being generated and not all CRC values of the Snappy stream are checked. // However, it provides really fast recompression of Snappy streams. // The converter can be reused to avoid allocations, even after errors. +// +// Deprecated: Decode the stream with s2.NewReader, which reads Snappy streams, +// and compress the output with an Encoder. This validates the input and +// compresses much better. type SnappyConverter struct { r io.Reader err error @@ -373,6 +377,14 @@ func decodeSnappy(blk *blockEnc, src []byte) error { offset = uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24 } + // A zstd match is at least zstdMinMatch bytes. A shorter copy + // cannot be represented as a sequence and would underflow the + // matchLen computation below, producing an out-of-range match + // length code. + if length < zstdMinMatch { + return ErrSnappyCorrupt + } + if offset <= 0 || blk.size+lits < int(offset) /*|| length > len(blk)-d */ { println("offset <= 0 || blk.size+lits < int(offset)", offset, blk.size+lits, int(offset), blk.size, lits) diff --git a/vendor/modules.txt b/vendor/modules.txt index ff0304467f49..9a3ed856f163 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -145,7 +145,7 @@ github.com/grpc-ecosystem/grpc-gateway/v2/utilities # github.com/inconshreveable/mousetrap v1.1.0 ## explicit; go 1.18 github.com/inconshreveable/mousetrap -# github.com/klauspost/compress v1.20.1 +# github.com/klauspost/compress v1.20.2 ## explicit; go 1.25 github.com/klauspost/compress github.com/klauspost/compress/fse From 5cb4227e057d645ea584bdb2465e4f971a9749d7 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 17 Nov 2026 12:51:11 +0100 Subject: [PATCH 19/25] ci: validate PR milestones using branch status issue - Read the next release version from a persistent GitHub issue - Replace VERSION file dependency with branch-specific version tracking - Keep milestone validation aligned with moby Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 28fd12db51fbfdbdf5f50071d69dad0bab860c17) Signed-off-by: Sebastiaan van Stijn --- .github/workflows/validate-milestone.yml | 85 ++++++++++++++++-------- 1 file changed, 59 insertions(+), 26 deletions(-) diff --git a/.github/workflows/validate-milestone.yml b/.github/workflows/validate-milestone.yml index 0b74e95c9b6e..65377b512395 100644 --- a/.github/workflows/validate-milestone.yml +++ b/.github/workflows/validate-milestone.yml @@ -1,50 +1,64 @@ name: validate-milestone +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + permissions: - contents: read - pull-requests: read + issues: read on: pull_request: - types: [opened, synchronize, milestoned, demilestoned, edited] + types: [opened, reopened, edited, synchronize, milestoned, demilestoned] jobs: validate-milestone: + if: ${{ github.repository == 'docker/cli' && github.event.pull_request.state == 'open' }} runs-on: ubuntu-26.04 timeout-minutes: 5 steps: - - name: Validate milestone matches VERSION + - name: Validate milestone matches next version uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: MILESTONE: ${{ github.event.pull_request.milestone.title }} + # Pinned "[Branch status]" issue with a "json docker-versions" block + # mapping each branch to its next and last version. + BRANCH_STATUS_ISSUE: 7526 with: script: | - const files = await github.paginate(github.rest.pulls.listFiles, { + const issueNumber = Number(process.env.BRANCH_STATUS_ISSUE); + const source = `issue #${issueNumber}`; + const baseBranch = context.payload.pull_request.base.ref; + core.info(`Base branch: ${baseBranch}`); + + const {data: issue} = await github.rest.issues.get({ owner: context.repo.owner, repo: context.repo.repo, - pull_number: context.payload.pull_request.number, + issue_number: issueNumber, }); - core.info(`Modified files: ${files.map(f => f.filename).join(', ')}`); - - const touchesVersion = files.some(f => f.filename === 'VERSION'); - core.info(`Touches VERSION: ${touchesVersion}`); - - // Use the PR's version when it bumps the file, base branch otherwise. - // It's fine to trust the author in this case, it's not meant to be - // a security gate, just a helpful check for maintainers. - const ref = touchesVersion - ? context.payload.pull_request.head.sha - : context.payload.pull_request.base.ref; + const lines = (issue.body ?? '').split('\n').map(line => line.trimEnd()); + const start = lines.indexOf('```json docker-versions') + 1; + const end = lines.indexOf('```', start); + if (start === 0 || end === -1) { + core.setFailed(`Could not find a 'json docker-versions' block in ${source}`); + return; + } - core.info(`Base ref: ${ref}`); + // For example: {"master": {"next": "29.10.0", "last": "29.9.1"}} + let versions; + try { + versions = JSON.parse(lines.slice(start, end).join('\n')); + } catch (err) { + core.setFailed(`Invalid 'json docker-versions' block in ${source}: ${err.message}`); + return; + } + core.info(`Versions: ${JSON.stringify(versions)}`); - const resp = await github.rest.repos.getContent({ - owner: context.repo.owner, - repo: context.repo.repo, - path: 'VERSION', - ref, - }); - const expected = Buffer.from(resp.data.content, resp.data.encoding).toString('utf8').trim(); + const expected = versions?.[baseBranch]?.next; + if (!expected) { + core.setFailed(`Could not find the next version for branch '${baseBranch}' in ${source}`); + return; + } const milestone = process.env.MILESTONE; if (!milestone) { @@ -52,7 +66,26 @@ jobs: return; } if (milestone !== expected) { - core.setFailed(`Milestone '${milestone}' does not match VERSION '${expected}'`); + const guidance = + 'This check prevents the PR from being merged accidentally before it is appropriate ' + + 'for its milestone. If the milestone is intentional, no action is needed.'; + await core.summary + .addHeading('This PR is intentionally blocked from merging for now') + .addTable([ + [ + {data: 'Milestone', header: true}, + {data: 'Expected next version', header: true}, + ], + [milestone, expected], + ]) + .addRaw(`The expected version for the '${baseBranch}' branch comes from ${source}.`) + .addEOL() + .addRaw(guidance) + .write(); + core.setFailed( + `This PR cannot be merged yet because milestone '${milestone}' does not match ` + + `the next version '${expected}'. ${guidance}` + ); return; } core.info(`Milestone: ${milestone} ✓`); From 837430042a32317e18d8e3429ce34f9ff41e3830 Mon Sep 17 00:00:00 2001 From: Jeffrey Johnson Date: Thu, 12 Nov 2026 18:34:29 -0800 Subject: [PATCH 20/25] cmd/docker: update the Windows icon to the new Docker logo Docker has a new logo. Replace the icon embedded in docker.exe on Windows with Docker Desktop's Windows app icon: the black 2026 whale on a blurple (6172FF) circle, which reads in light and dark File Explorer. It has 16, 24, 32, 48, 64, 128 and 256 pixel frames and is identical to the dockerd.exe icon in moby/moby. Signed-off-by: Jeffrey Johnson (cherry picked from commit 32ca18fb121f5df4c0c0284cc9bc98019de073d3) Signed-off-by: Sebastiaan van Stijn --- cmd/docker/internal/assets/docker.ico | Bin 102330 -> 109714 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/cmd/docker/internal/assets/docker.ico b/cmd/docker/internal/assets/docker.ico index 1d5ab4f0a9bd194e0aa1bd47c988385b0f96a317..e4bc5d4291ce8dc69543f0dcc4015c3ba3370c77 100644 GIT binary patch literal 109714 zcmeHQ30zFy7oQeXsHV-Jy`)WM6pGMBt4a$ZHObb`)?ych7SV#D>{OEdhyM1Zl8}A- z`B{G@`GOHrx$oWOob$c+-0j?ZNhC2+JCeLS30zImBuNr! z7KucnP#FHD(j?L&c&Dk!@MlA~39=*-mCE#YBavh^NF*yOhF{-?L^@t4!Z-fQYld#Z$+gM1zC;UOb(L4B7 zSA5LdyDb(xfe`Efkg|4Q9SI!_`d(gr%n-8gPE= zr@5|lf3e644^tUJ$3o3%m|o{jn06l*q z);bKV9-qL789&F+ME1SZ?1B#Dm zsDpkowDM#qq<-0HfTpe{aCgC_i|7RQ4NDeyh^pvHqa=#2-tU8iG5BiPX zp>Gg|n>0~aY`UL1#NWnfvA zAN;4)mIsq=Ug`^bUccD+z~#-GOxV*V{2;5}crdXfzVXKe%#oZJWw53mK|1N=2q!Gl z#irJ0+fW4)BQ14Y`VKzTFkmr?Og!27xZL( zX|jKNJYhubd{ouT>g{@xU4O39KMU;}!Fx5gs?JwWKhd@ySLvhnvs$`U@?h$dDnBEi zhSCq98R3{u?@Pt$s5gC_hwAj#C!ggu7T6gd7i?TFV{D*~2A;lScO7h!Sr6>G|FG(O zRO!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mention OATs Signed-off-by: Maria Ines Parnisari (cherry picked from commit ac057b79e5723c35220d92fe277f7551c94864b2) Signed-off-by: Sebastiaan van Stijn --- cli/command/registry.go | 13 +++++++------ cli/command/registry/login.go | 6 +++--- docs/reference/commandline/login.md | 30 ++++++++++++++++++++++++----- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/cli/command/registry.go b/cli/command/registry.go index 2e767d5b72f3..a949f8afed91 100644 --- a/cli/command/registry.go +++ b/cli/command/registry.go @@ -24,9 +24,10 @@ import ( const ( registerSuggest = "Log in with your Docker ID or email address to push and pull images from Docker Hub. " + "If you don't have a Docker ID, head over to https://hub.docker.com/ to create one." - patSuggest = "You can log in with your password or a Personal Access " + - "Token (PAT). Using a limited-scope PAT grants better security and is required " + - "for organizations using SSO. Learn more at https://docs.docker.com/go/access-tokens/" + patOrOatSuggest = "You can use a personal access token (PAT) or organization access token (OAT) instead of a password. " + + "Scoped tokens improve security; a PAT is required for password-based login with SSO. " + + "When using an OAT, use your organization name as the username. " + + "Learn more at https://docs.docker.com/go/access-tokens/" ) // authConfigKey is the key used to store credentials for Docker Hub. It is @@ -123,7 +124,7 @@ func PromptUserForCredentials(ctx context.Context, cli Streams, argUser, argPass // a token instead of a password. _, _ = fmt.Fprintln(cli.Out(), registerSuggest) if hints.Enabled() { - _, _ = fmt.Fprintln(cli.Out(), patSuggest) + _, _ = fmt.Fprintln(cli.Out(), patOrOatSuggest) _, _ = fmt.Fprintln(cli.Out()) } } @@ -167,8 +168,8 @@ func PromptUserForCredentials(ctx context.Context, cli Streams, argUser, argPass if serverAddress == authConfigKey { out := tui.NewOutput(cli.Err()) - out.PrintNote("A Personal Access Token (PAT) can be used instead.\n" + - "To create a PAT, visit " + aec.Underline.Apply("https://app.docker.com/settings") + "\n\n") + out.PrintNote("You can use a personal access token (PAT) or organization access token (OAT) instead of a password.\n" + + "Learn more at " + aec.Underline.Apply("https://docs.docker.com/go/access-tokens/") + "\n\n") } argPassword, err = prompt.ReadInput(ctx, stdIn, cli.Out(), "Password: ") diff --git a/cli/command/registry/login.go b/cli/command/registry/login.go index 2b522910d800..ac2481835a31 100644 --- a/cli/command/registry/login.go +++ b/cli/command/registry/login.go @@ -62,9 +62,9 @@ func newLoginCommand(dockerCLI command.Cli) *cobra.Command { flags := cmd.Flags() - flags.StringVarP(&opts.user, "username", "u", "", "Username") - flags.StringVarP(&opts.password, "password", "p", "", `Password or Personal Access Token (PAT), or "-" to read from stdin`) - flags.BoolVar(&opts.passwordStdin, "password-stdin", false, "Take the Password or Personal Access Token (PAT) from stdin") + flags.StringVarP(&opts.user, "username", "u", "", "Username or organization name (for OATs)") + flags.StringVarP(&opts.password, "password", "p", "", `Password or access token. Use "-" to read from stdin`) + flags.BoolVar(&opts.passwordStdin, "password-stdin", false, "Read password or access token from stdin") return cmd } diff --git a/docs/reference/commandline/login.md b/docs/reference/commandline/login.md index 458edd7b91b0..4603bb96d655 100644 --- a/docs/reference/commandline/login.md +++ b/docs/reference/commandline/login.md @@ -6,11 +6,11 @@ Defaults to Docker Hub if no server is specified. ### Options -| Name | Type | Default | Description | -|:---------------------------------------------|:---------|:--------|:-------------------------------------------------------------------| -| `-p`, `--password` | `string` | | Password or Personal Access Token (PAT), or `-` to read from stdin | -| [`--password-stdin`](#password-stdin) | `bool` | | Take the Password or Personal Access Token (PAT) from stdin | -| [`-u`](#username), [`--username`](#username) | `string` | | Username | +| Name | Type | Default | Description | +|:---------------------------------------------|:---------|:--------|:-----------------------------------------------------| +| `-p`, `--password` | `string` | | Password or access token. Use `-` to read from stdin | +| [`--password-stdin`](#password-stdin) | `bool` | | Read password or access token from stdin | +| [`-u`](#username), [`--username`](#username) | `string` | | Username or organization name (for OATs) | @@ -229,6 +229,26 @@ with the username `moby`. The password is entered interactively. $ docker login -u moby ``` +### Authenticate with an access token + +To authenticate to Docker Hub with a [personal access token (PAT)](https://docs.docker.com/security/access-tokens/personal-access-tokens/) +or [organization access token (OAT)](https://docs.docker.com/security/access-tokens/organization-access-tokens/), +use the token in place of a password. + +For a PAT, use your Docker ID as the username. For an OAT, use your +organization name instead. The following example authenticates using +the organization `myorg`. The token is entered interactively. + +```console +$ docker login --username myorg +``` + +To authenticate non-interactively, see [Provide a password using STDIN](#password-stdin). + +> [!NOTE] +> OATs don't support Docker Desktop sign-in or Image Access Management. +> Use web-based sign-in or a PAT instead, where supported. + ### Provide a password using STDIN (--password-stdin) To run the `docker login` command non-interactively, you can set the From 43330ba47c1da00f3436c401236880ebe58f9e43 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 10 Nov 2026 21:14:56 +0100 Subject: [PATCH 22/25] vendor: github.com/moby/sys/user v0.5.0 full diff: https://github.com/moby/sys/compare/user/v0.4.1...user/v0.5.0 Signed-off-by: Sebastiaan van Stijn (cherry picked from commit a2a9fec669e9edc700b27b16a55f119281aafcc0) Signed-off-by: Sebastiaan van Stijn --- vendor.mod | 2 +- vendor.sum | 4 +- vendor/github.com/moby/sys/user/idtools.go | 68 +++++------ .../github.com/moby/sys/user/idtools_unix.go | 9 +- .../moby/sys/user/idtools_windows.go | 25 +++- vendor/github.com/moby/sys/user/user.go | 110 +++++------------- vendor/github.com/moby/sys/user/user_utils.go | 62 ++++++++++ vendor/modules.txt | 4 +- 8 files changed, 155 insertions(+), 129 deletions(-) diff --git a/vendor.mod b/vendor.mod index 8c2ecc54343c..87a484311f9f 100644 --- a/vendor.mod +++ b/vendor.mod @@ -89,7 +89,7 @@ require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/klauspost/compress v1.20.2 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect - github.com/moby/sys/user v0.4.1 // indirect + github.com/moby/sys/user v0.5.0 // indirect github.com/moby/sys/userns v0.2.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/prometheus/client_golang v1.22.0 // indirect diff --git a/vendor.sum b/vendor.sum index 5e0a24bdb5cd..071f844587ae 100644 --- a/vendor.sum +++ b/vendor.sum @@ -110,8 +110,8 @@ github.com/moby/sys/signal v0.7.1 h1:PrQxdvxcGijdo6UXXo/lU/TvHUWyPhj7UOpSo8tuvk0 github.com/moby/sys/signal v0.7.1/go.mod h1:Se1VGehYokAkrSQwL4tDzHvETwUZlnY7S5XtQ50mQp8= github.com/moby/sys/symlink v0.3.0 h1:GZX89mEZ9u53f97npBy4Rc3vJKj7JBDj/PN2I22GrNU= github.com/moby/sys/symlink v0.3.0/go.mod h1:3eNdhduHmYPcgsJtZXW1W4XUJdZGBIkttZ8xKqPUJq0= -github.com/moby/sys/user v0.4.1 h1:RgjRlaDKi/Xmyrz4t8lyzXT6v2ooFeO/7xtchmhVWE0= -github.com/moby/sys/user v0.4.1/go.mod h1:E9QsW5WRe1kUAf7kW8hXKwu1uhsZEAdPLYHYSDudF4Y= +github.com/moby/sys/user v0.5.0 h1:5+S4lyoavGyX1DGs68NW8xpx48T9+a7ogSUc0KjZg8Y= +github.com/moby/sys/user v0.5.0/go.mod h1:4mQzP5aTmaLjDLp/dc870oNkik6E9vjRtWYwI05gvow= github.com/moby/sys/userns v0.2.1 h1:4OvdM7BcPkASbuouHsbW3aeMJSFlYDldBRnXVZhaRk8= github.com/moby/sys/userns v0.2.1/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= github.com/moby/term v0.5.2 h1:6qk3FJAFDs6i/q3W/pQ97SX192qKfZgGjCQqfCJkgzQ= diff --git a/vendor/github.com/moby/sys/user/idtools.go b/vendor/github.com/moby/sys/user/idtools.go index 595b7a927263..147815311166 100644 --- a/vendor/github.com/moby/sys/user/idtools.go +++ b/vendor/github.com/moby/sys/user/idtools.go @@ -12,37 +12,39 @@ type mkdirOptions struct { onlyNew bool } -// WithOnlyNew is an option for MkdirAllAndChown that will only change ownership and permissions -// on newly created directories. If the directory already exists, it will not be modified +// WithOnlyNew configures [MkdirAllAndChown] and [MkdirAndChown] to leave +// the requested directory unchanged if it already exists. Newly created +// directories are still assigned the requested ownership and permissions. func WithOnlyNew(o *mkdirOptions) { o.onlyNew = true } -// MkdirAllAndChown creates a directory (include any along the path) and then modifies -// ownership to the requested uid/gid. By default, if the directory already exists, this -// function will still change ownership and permissions. If WithOnlyNew is passed as an -// option, then only the newly created directories will have ownership and permissions changed. +// MkdirAllAndChown creates a directory named path, along with any necessary +// parents, and applies the requested ownership and permission bits to all +// directories it creates. +// +// If path already exists as a directory, its ownership and permission bits +// are updated unless [WithOnlyNew] is specified. Existing parent directories +// are not modified. +// +// MkdirAllAndChown is similar to [os.MkdirAll], but also applies ownership and +// reapplies the requested permission bits after creation, so the resulting +// permissions are not affected by the process umask. func MkdirAllAndChown(path string, mode os.FileMode, uid, gid int, opts ...MkdirOpt) error { - var options mkdirOptions - for _, opt := range opts { - opt(&options) - } - - return mkdirAs(path, mode, uid, gid, true, options.onlyNew) + return mkdirAs(path, mode, uid, gid, true, opts...) } -// MkdirAndChown creates a directory and then modifies ownership to the requested uid/gid. -// By default, if the directory already exists, this function still changes ownership and permissions. -// If WithOnlyNew is passed as an option, then only the newly created directory will have ownership -// and permissions changed. -// Note that unlike os.Mkdir(), this function does not return IsExist error -// in case path already exists. +// MkdirAndChown creates a directory named path and applies the requested +// ownership and permission bits. +// +// If path already exists as a directory, its ownership and permission bits +// are updated unless [WithOnlyNew] is specified. +// +// MkdirAndChown is similar to [os.Mkdir], but returns nil if path already +// exists as a directory. The resulting permission bits are not affected by +// the process umask. func MkdirAndChown(path string, mode os.FileMode, uid, gid int, opts ...MkdirOpt) error { - var options mkdirOptions - for _, opt := range opts { - opt(&options) - } - return mkdirAs(path, mode, uid, gid, false, options.onlyNew) + return mkdirAs(path, mode, uid, gid, false, opts...) } // getRootUIDGID retrieves the remapped root uid/gid pair from the set of maps. @@ -106,22 +108,14 @@ func (i IdentityMapping) RootPair() (int, int) { return uid, gid } -// ToHost returns the host UID and GID for the container uid, gid. -// Remapping is only performed if the ids aren't already the remapped root ids +// ToHost returns the host UID and GID for the container uid and gid. +// An empty mapping is treated as identity. func (i IdentityMapping) ToHost(uid, gid int) (int, int, error) { - var err error - ruid, rgid := i.RootPair() - - if uid != ruid { - ruid, err = toHost(uid, i.UIDMaps) - if err != nil { - return ruid, rgid, err - } - } - - if gid != rgid { - rgid, err = toHost(gid, i.GIDMaps) + ruid, err := toHost(uid, i.UIDMaps) + if err != nil { + return -1, -1, err } + rgid, err := toHost(gid, i.GIDMaps) return ruid, rgid, err } diff --git a/vendor/github.com/moby/sys/user/idtools_unix.go b/vendor/github.com/moby/sys/user/idtools_unix.go index 4e39d2446b23..679aaa3a2699 100644 --- a/vendor/github.com/moby/sys/user/idtools_unix.go +++ b/vendor/github.com/moby/sys/user/idtools_unix.go @@ -10,7 +10,12 @@ import ( "syscall" ) -func mkdirAs(path string, mode os.FileMode, uid, gid int, mkAll, onlyNew bool) error { +func mkdirAs(path string, mode os.FileMode, uid, gid int, mkAll bool, opts ...MkdirOpt) error { + var options mkdirOptions + for _, opt := range opts { + opt(&options) + } + path, err := filepath.Abs(path) if err != nil { return err @@ -21,7 +26,7 @@ func mkdirAs(path string, mode os.FileMode, uid, gid int, mkAll, onlyNew bool) e if !stat.IsDir() { return &os.PathError{Op: "mkdir", Path: path, Err: syscall.ENOTDIR} } - if onlyNew { + if options.onlyNew { return nil } diff --git a/vendor/github.com/moby/sys/user/idtools_windows.go b/vendor/github.com/moby/sys/user/idtools_windows.go index 9de730cafbe0..3973d5593a22 100644 --- a/vendor/github.com/moby/sys/user/idtools_windows.go +++ b/vendor/github.com/moby/sys/user/idtools_windows.go @@ -2,12 +2,25 @@ package user import ( "os" + "syscall" ) -// This is currently a wrapper around [os.MkdirAll] since currently -// permissions aren't set through this path, the identity isn't utilized. -// Ownership is handled elsewhere, but in the future could be support here -// too. -func mkdirAs(path string, _ os.FileMode, _, _ int, _, _ bool) error { - return os.MkdirAll(path, 0) +// mkdirAs creates path, optionally creating any missing parent directories. +// +// On Windows this is currently a thin wrapper around os.Mkdir and +// os.MkdirAll. Unlike the Unix implementation, ownership and permission +// bits are not applied. +func mkdirAs(path string, _ os.FileMode, _, _ int, mkAll bool, _ ...MkdirOpt) error { + if mkAll { + return os.MkdirAll(path, 0) + } + stat, err := os.Stat(path) + if err == nil { + if !stat.IsDir() { + return &os.PathError{Op: "mkdir", Path: path, Err: syscall.ENOTDIR} + } + return nil + } + + return os.Mkdir(path, 0) } diff --git a/vendor/github.com/moby/sys/user/user.go b/vendor/github.com/moby/sys/user/user.go index 857711ebfd21..48c34a8b2310 100644 --- a/vendor/github.com/moby/sys/user/user.go +++ b/vendor/github.com/moby/sys/user/user.go @@ -7,6 +7,7 @@ import ( "fmt" "io" "os" + "slices" "strconv" "strings" ) @@ -17,9 +18,9 @@ const ( ) var ( - // ErrNoPasswdEntries is returned if no matching entries were found in /etc/group. + // ErrNoPasswdEntries is returned if no matching entries were found in /etc/passwd. ErrNoPasswdEntries = errors.New("no matching entries in passwd file") - // ErrNoGroupEntries is returned if no matching entries were found in /etc/passwd. + // ErrNoGroupEntries is returned if no matching entries were found in /etc/group. ErrNoGroupEntries = errors.New("no matching entries in group file") // ErrRange is returned if a UID or GID is outside of the valid range. ErrRange = fmt.Errorf("uids and gids must be in range %d-%d", minID, maxID) @@ -243,9 +244,6 @@ func GetExecUserPath(userSpec string, defaults *ExecUser, passwdPath, groupPath // // See https://github.com/containerd/containerd/commit/de1341c201ffb0effebbf51d00376181968c8779 func parseNumeric(val string) (int, bool, error) { - if val == "" { - return 0, false, nil - } id, err := strconv.Atoi(val) if err != nil { if errors.Is(err, strconv.ErrSyntax) { @@ -296,51 +294,40 @@ func GetExecUser(userSpec string, defaults *ExecUser, passwd, group io.Reader) ( user := &ExecUser{ Uid: defaults.Uid, Gid: defaults.Gid, - Sgids: defaults.Sgids, + Sgids: append([]int{}, defaults.Sgids...), // Sgids slice *cannot* be nil. Home: defaults.Home, } - // Sgids slice *cannot* be nil. - if user.Sgids == nil { - user.Sgids = []int{} - } - - // Allow for userArg to have either "user" syntax, or optionally "user:group" syntax - var userArg, groupArg string - parseLine([]byte(userSpec), &userArg, &groupArg) + // Allow for userSpec to have either "user", or optionally "user:group" syntax. + usr, grp, _ := strings.Cut(userSpec, ":") - // Convert userArg and groupArg to be numeric, so we don't have to execute + // Convert usr and grp to be numeric, so we don't have to execute // Atoi *twice* for each iteration over lines. - uidArg, isUID, err := parseNumeric(userArg) + userArg, err := parseUserArg(usr) if err != nil { return nil, err } - gidArg, isGID, err := parseNumeric(groupArg) + groupArg, err := parseGroupArg(grp) if err != nil { return nil, err } // Find the matching user. users, err := ParsePasswdFilter(passwd, func(u User) bool { - if userArg == "" { + if userArg == nil { // Default to current state of the user. return u.Uid == user.Uid } - - if isUID { - // If the userArg is a valid numeric value, always treat it as a UID. - return uidArg == u.Uid - } - - return u.Name == userArg + return userArg.matches(u) }) // If we can't find the user, we have to bail. if err != nil && passwd != nil { - if userArg == "" { - userArg = strconv.Itoa(user.Uid) + name := usr + if userArg == nil { + name = strconv.Itoa(user.Uid) } - return nil, fmt.Errorf("unable to find user %s: %w", userArg, err) + return nil, fmt.Errorf("unable to find user %s: %w", name, err) } var matchedUserName string @@ -350,57 +337,42 @@ func GetExecUser(userSpec string, defaults *ExecUser, passwd, group io.Reader) ( user.Uid = users[0].Uid user.Gid = users[0].Gid user.Home = users[0].Home - } else if userArg != "" { + } else if userArg != nil { // If we can't find a user with the given username, the only other valid // option is if it's a numeric username with no associated entry in passwd. - - if !isUID { - // Not numeric. - return nil, fmt.Errorf("unable to find user %s: %w", userArg, ErrNoPasswdEntries) + if !userArg.isNumeric { + return nil, fmt.Errorf("unable to find user %s: %w", userArg.name, ErrNoPasswdEntries) } - user.Uid = uidArg + user.Uid = userArg.uid } // On to the groups. If we matched a username, we need to do this because of // the supplementary group IDs. - if groupArg != "" || matchedUserName != "" { + if groupArg != nil || matchedUserName != "" { groups, err := ParseGroupFilter(group, func(g Group) bool { // If the group argument isn't explicit, we'll just search for it. - if groupArg == "" { + if groupArg == nil { // Check if user is a member of this group. - for _, u := range g.List { - if u == matchedUserName { - return true - } - } - return false - } - - if isGID { - // If the groupArg is numeric, always treat it as a GID. - return gidArg == g.Gid + return slices.Contains(g.List, matchedUserName) } - - return g.Name == groupArg + return groupArg.matches(g) }) if err != nil && group != nil { return nil, fmt.Errorf("unable to find groups for spec %v: %w", matchedUserName, err) } // Only start modifying user.Gid if it is in explicit form. - if groupArg != "" { + if groupArg != nil { if len(groups) > 0 { // First match wins, even if there's more than one matching entry. user.Gid = groups[0].Gid } else { // If we can't find a group with the given name, the only other valid // option is if it's a numeric group name with no associated entry in group. - - if !isGID { - // Not numeric. - return nil, fmt.Errorf("unable to find group %s: %w", groupArg, ErrNoGroupEntries) + if !groupArg.isNumeric { + return nil, fmt.Errorf("unable to find group %s: %w", groupArg.name, ErrNoGroupEntries) } - user.Gid = gidArg + user.Gid = groupArg.gid } } else if len(groups) > 0 { // Supplementary group ids only make sense if in the implicit form. @@ -414,39 +386,19 @@ func GetExecUser(userSpec string, defaults *ExecUser, passwd, group io.Reader) ( return user, nil } -// groupArg is a parsed group argument for [GetAdditionalGroups]. -type groupArg struct { - name string - gid int - isNumeric bool -} - -// matches reports whether group g satisfies the argument. Numeric arguments -// are matched by GID only, others by name. -func (ag groupArg) matches(g Group) bool { - if ag.isNumeric { - return g.Gid == ag.gid - } - return g.Name == ag.name -} - // GetAdditionalGroups looks up a list of groups by name or group id // against the given /etc/group formatted data. If a group name cannot // be found, an error will be returned. If a group id cannot be found, // or the given group data is nil, the id will be returned as-is // provided it is in the legal range. func GetAdditionalGroups(additionalGroups []string, group io.Reader) ([]int, error) { - addtlGroups := make([]groupArg, len(additionalGroups)) - for i, ag := range additionalGroups { - gid, ok, err := parseNumeric(ag) + addtlGroups := make([]groupArg, 0, len(additionalGroups)) + for _, ag := range additionalGroups { + groupArg, err := parseGroupArg(ag) if err != nil { return nil, err } - addtlGroups[i] = groupArg{ - name: ag, - gid: gid, - isNumeric: ok, - } + addtlGroups = append(addtlGroups, *groupArg) } groups := []Group{} diff --git a/vendor/github.com/moby/sys/user/user_utils.go b/vendor/github.com/moby/sys/user/user_utils.go index 978aa927ed30..8084d3b0717a 100644 --- a/vendor/github.com/moby/sys/user/user_utils.go +++ b/vendor/github.com/moby/sys/user/user_utils.go @@ -62,3 +62,65 @@ func (l *limitedFile) Read(p []byte) (int, error) { } return n, err } + +// userArg is a parsed user argument for [GetExecUser]. +type userArg struct { + name string + uid int + isNumeric bool +} + +// parseUserArg parses a user argument as either a user name or UID. +// +// If name is empty, parseUserArg returns "nil, nil" to indicate that no user +// argument was specified. +func parseUserArg(name string) (*userArg, error) { + if name == "" { + return nil, nil + } + uid, isNumeric, err := parseNumeric(name) + if err != nil { + return nil, err + } + return &userArg{name: name, uid: uid, isNumeric: isNumeric}, nil +} + +// matches reports whether user u satisfies the argument. Numeric arguments +// are matched by UID only, others by name. +func (ua *userArg) matches(u User) bool { + if ua.isNumeric { + return u.Uid == ua.uid + } + return u.Name == ua.name +} + +// groupArg is a parsed group argument for [GetAdditionalGroups] or [GetExecUser]. +type groupArg struct { + name string + gid int + isNumeric bool +} + +// parseGroupArg parses a group argument as either a group name or GID. +// +// If name is empty, parseGroupArg returns "nil, nil" to indicate that no group +// argument was specified. +func parseGroupArg(name string) (*groupArg, error) { + if name == "" { + return nil, nil + } + gid, isNumeric, err := parseNumeric(name) + if err != nil { + return nil, err + } + return &groupArg{name: name, gid: gid, isNumeric: isNumeric}, nil +} + +// matches reports whether group g satisfies the argument. Numeric arguments +// are matched by GID only, others by name. +func (ag groupArg) matches(g Group) bool { + if ag.isNumeric { + return g.Gid == ag.gid + } + return g.Name == ag.name +} diff --git a/vendor/modules.txt b/vendor/modules.txt index a4d5bcda8909..94e88ca15873 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -228,8 +228,8 @@ github.com/moby/sys/signal # github.com/moby/sys/symlink v0.3.0 ## explicit; go 1.17 github.com/moby/sys/symlink -# github.com/moby/sys/user v0.4.1 -## explicit; go 1.18 +# github.com/moby/sys/user v0.5.0 +## explicit; go 1.24 github.com/moby/sys/user # github.com/moby/sys/userns v0.2.1 ## explicit; go 1.21 From 33bb75b4c3aa2f1ce7b72846b709b82861e67228 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 24 Nov 2026 12:37:24 +0100 Subject: [PATCH 23/25] vendor: github.com/moby/sys/user v0.5.1 Security This release includes fixes for unbounded reads when parsing user, group, and ID mapping files, which could lead to excessive resource consumption and denial of service. For details, see [CVE-2026-135844] / [GHSA-ffh6-8jcg-cjmw]. What's changed - user: stricter parsing - user: limit reads when parsing passwd and group files - user: limit reads when parsing ID mapping files - user: mkdirAs: refactor and touch-up comments for clarity full diff: https://github.com/moby/sys/compare/user/v0.5.0...user/v0.5.1 [CVE-2026-135844]: https://www.cve.org/CVERecord?id=CVE-2026-135844 [GHSA-ffh6-8jcg-cjmw]: https://github.com/moby/sys/security/advisories/GHSA-ffh6-8jcg-cjmw Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 21c1b437329b0771a40b218aeafe0572ffbe46c1) Signed-off-by: Sebastiaan van Stijn --- vendor.mod | 2 +- vendor.sum | 4 +- .../github.com/moby/sys/user/idtools_unix.go | 52 +++-- .../github.com/moby/sys/user/lookup_unix.go | 44 ++-- vendor/github.com/moby/sys/user/user.go | 207 +++++++++++++----- vendor/github.com/moby/sys/user/user_utils.go | 16 +- vendor/modules.txt | 2 +- 7 files changed, 210 insertions(+), 117 deletions(-) diff --git a/vendor.mod b/vendor.mod index 87a484311f9f..a1bf702a647a 100644 --- a/vendor.mod +++ b/vendor.mod @@ -89,7 +89,7 @@ require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/klauspost/compress v1.20.2 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect - github.com/moby/sys/user v0.5.0 // indirect + github.com/moby/sys/user v0.5.1 // indirect github.com/moby/sys/userns v0.2.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/prometheus/client_golang v1.22.0 // indirect diff --git a/vendor.sum b/vendor.sum index 071f844587ae..f13bf3fd84ff 100644 --- a/vendor.sum +++ b/vendor.sum @@ -110,8 +110,8 @@ github.com/moby/sys/signal v0.7.1 h1:PrQxdvxcGijdo6UXXo/lU/TvHUWyPhj7UOpSo8tuvk0 github.com/moby/sys/signal v0.7.1/go.mod h1:Se1VGehYokAkrSQwL4tDzHvETwUZlnY7S5XtQ50mQp8= github.com/moby/sys/symlink v0.3.0 h1:GZX89mEZ9u53f97npBy4Rc3vJKj7JBDj/PN2I22GrNU= github.com/moby/sys/symlink v0.3.0/go.mod h1:3eNdhduHmYPcgsJtZXW1W4XUJdZGBIkttZ8xKqPUJq0= -github.com/moby/sys/user v0.5.0 h1:5+S4lyoavGyX1DGs68NW8xpx48T9+a7ogSUc0KjZg8Y= -github.com/moby/sys/user v0.5.0/go.mod h1:4mQzP5aTmaLjDLp/dc870oNkik6E9vjRtWYwI05gvow= +github.com/moby/sys/user v0.5.1 h1:IMM/21OvpU2icUZczWBwLMf8iBEx1bOoiCQqcy1eKu0= +github.com/moby/sys/user v0.5.1/go.mod h1:4mQzP5aTmaLjDLp/dc870oNkik6E9vjRtWYwI05gvow= github.com/moby/sys/userns v0.2.1 h1:4OvdM7BcPkASbuouHsbW3aeMJSFlYDldBRnXVZhaRk8= github.com/moby/sys/userns v0.2.1/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= github.com/moby/term v0.5.2 h1:6qk3FJAFDs6i/q3W/pQ97SX192qKfZgGjCQqfCJkgzQ= diff --git a/vendor/github.com/moby/sys/user/idtools_unix.go b/vendor/github.com/moby/sys/user/idtools_unix.go index 679aaa3a2699..929aaa07a7e9 100644 --- a/vendor/github.com/moby/sys/user/idtools_unix.go +++ b/vendor/github.com/moby/sys/user/idtools_unix.go @@ -3,6 +3,7 @@ package user import ( + "errors" "fmt" "os" "path/filepath" @@ -21,51 +22,48 @@ func mkdirAs(path string, mode os.FileMode, uid, gid int, mkAll bool, opts ...Mk return err } - stat, err := os.Stat(path) - if err == nil { + stat, statErr := os.Stat(path) + if statErr == nil { if !stat.IsDir() { return &os.PathError{Op: "mkdir", Path: path, Err: syscall.ENOTDIR} } + // The requested directory already exists. Leave it unchanged when only + // newly created directories should receive the requested metadata. if options.onlyNew { return nil } - - // short-circuit -- we were called with an existing directory and chown was requested return setPermissions(path, mode, uid, gid, stat) } - // make an array containing the original path asked for, plus (for mkAll == true) - // all path components leading up to the complete path that don't exist before we MkdirAll - // so that we can chown all of them properly at the end. If onlyNew is true, we won't - // chown the full directory path if it exists - var paths []string - if os.IsNotExist(err) { - paths = append(paths, path) + // Track the requested directory and any parent directories created by + // Mkdir/MkdirAll to set their ownership and permissions afterward. + var createdDirs []string + if errors.Is(statErr, os.ErrNotExist) { + createdDirs = append(createdDirs, path) } if mkAll { - // walk back to "/" looking for directories which do not exist - // and add them to the paths array for chown after creation - dirPath := path - for { - dirPath = filepath.Dir(dirPath) - if dirPath == "/" { - break - } - if _, err = os.Stat(dirPath); os.IsNotExist(err) { - paths = append(paths, dirPath) + if errors.Is(statErr, os.ErrNotExist) { + // Walk back to "/" looking for directories which do not exist + // and add them to the paths array for chown after creation. + // Stop at the first existing directory. + for p := filepath.Dir(path); p != "/"; p = filepath.Dir(p) { + if _, err := os.Stat(p); err == nil { + break + } else if errors.Is(err, os.ErrNotExist) { + createdDirs = append(createdDirs, p) + } } } - if err = os.MkdirAll(path, mode); err != nil { + if err := os.MkdirAll(path, mode); err != nil { return err } - } else if err = os.Mkdir(path, mode); err != nil { + } else if err := os.Mkdir(path, mode); err != nil { return err } - // even if it existed, we will chown the requested path + any subpaths that - // didn't exist when we called MkdirAll - for _, pathComponent := range paths { - if err = setPermissions(pathComponent, mode, uid, gid, nil); err != nil { + // Apply the requested ownership and permissions to each newly created directory. + for _, dir := range createdDirs { + if err := setPermissions(dir, mode, uid, gid, nil); err != nil { return err } } diff --git a/vendor/github.com/moby/sys/user/lookup_unix.go b/vendor/github.com/moby/sys/user/lookup_unix.go index 4540747d28fb..570793fe211c 100644 --- a/vendor/github.com/moby/sys/user/lookup_unix.go +++ b/vendor/github.com/moby/sys/user/lookup_unix.go @@ -20,7 +20,7 @@ const ( // cannot be found (or there is no /etc/passwd file on the filesystem), then // LookupUser returns an error. func LookupUser(username string) (User, error) { - return lookupUserFunc(func(u User) bool { + return lookupUserFileFilter(unixPasswdPath, func(u User) bool { return u.Name == username }) } @@ -29,21 +29,13 @@ func LookupUser(username string) (User, error) { // be found (or there is no /etc/passwd file on the filesystem), then LookupId // returns an error. func LookupUid(uid int) (User, error) { - return lookupUserFunc(func(u User) bool { + return lookupUserFileFilter(unixPasswdPath, func(u User) bool { return u.Uid == uid }) } -func lookupUserFunc(filter func(u User) bool) (User, error) { - // Get operating system-specific passwd reader-closer. - passwd, err := GetPasswd() - if err != nil { - return User{}, err - } - defer passwd.Close() - - // Get the users. - users, err := ParsePasswdFilter(passwd, filter) +func lookupUserFileFilter(path string, filter func(u User) bool) (User, error) { + users, err := ParsePasswdFileFilter(path, filter) if err != nil { return User{}, err } @@ -61,7 +53,7 @@ func lookupUserFunc(filter func(u User) bool) (User, error) { // be found (or there is no /etc/group file on the filesystem), then LookupGroup // returns an error. func LookupGroup(groupname string) (Group, error) { - return lookupGroupFunc(func(g Group) bool { + return lookupGroupFileFilter(unixGroupPath, func(g Group) bool { return g.Name == groupname }) } @@ -70,21 +62,13 @@ func LookupGroup(groupname string) (Group, error) { // be found (or there is no /etc/group file on the filesystem), then LookupGid // returns an error. func LookupGid(gid int) (Group, error) { - return lookupGroupFunc(func(g Group) bool { + return lookupGroupFileFilter(unixGroupPath, func(g Group) bool { return g.Gid == gid }) } -func lookupGroupFunc(filter func(g Group) bool) (Group, error) { - // Get operating system-specific group reader-closer. - group, err := GetGroup() - if err != nil { - return Group{}, err - } - defer group.Close() - - // Get the users. - groups, err := ParseGroupFilter(group, filter) +func lookupGroupFileFilter(path string, filter func(g Group) bool) (Group, error) { + groups, err := ParseGroupFileFilter(path, filter) if err != nil { return Group{}, err } @@ -98,18 +82,30 @@ func lookupGroupFunc(filter func(g Group) bool) (Group, error) { return groups[0], nil } +// GetPasswdPath returns the path to the system passwd file. func GetPasswdPath() (string, error) { return unixPasswdPath, nil } +// GetPasswd opens the system passwd file for reading. +// +// Unlike the file-based parsing functions, it does not restrict the file type +// or limit the amount of data that can be read. The caller is responsible for +// closing the returned reader. func GetPasswd() (io.ReadCloser, error) { return os.Open(unixPasswdPath) } +// GetGroupPath returns the path to the system group file. func GetGroupPath() (string, error) { return unixGroupPath, nil } +// GetGroup opens the system group file for reading. +// +// Unlike the file-based parsing functions, it does not restrict the file type +// or limit the amount of data that can be read. The caller is responsible for +// closing the returned reader. func GetGroup() (io.ReadCloser, error) { return os.Open(unixGroupPath) } diff --git a/vendor/github.com/moby/sys/user/user.go b/vendor/github.com/moby/sys/user/user.go index 48c34a8b2310..66b4a4b48b96 100644 --- a/vendor/github.com/moby/sys/user/user.go +++ b/vendor/github.com/moby/sys/user/user.go @@ -57,44 +57,67 @@ type IDMap struct { Count int64 } -func parseLine(line []byte, v ...any) { - parseParts(bytes.Split(line, []byte(":")), v...) +// parseLine parses a colon-separated record into the provided fields. +// See [parseParts] for details. +func parseLine(line []byte, v ...any) bool { + return parseParts(bytes.Split(line, []byte(":")), v...) } -func parseParts(parts [][]byte, v ...any) { - if len(parts) == 0 { - return - } - - for i, p := range parts { - // Ignore cases where we don't have enough fields to populate the arguments. - // Some configuration files like to misbehave. - if len(v) <= i { - break +// parseParts parses the provided parts into the corresponding fields, +// and reports whether the record is valid. +// +// Missing fields are treated as empty. Empty string fields are accepted, +// but missing, empty, non-numeric, or out-of-range integer fields make +// the record invalid. For *int fields (UIDs and GIDs), the valid range +// is the one checked by [validateID]. +// +// This follows the behavior of glibc's passwd and group parsers, which +// skip malformed records when reading entries. +// +// See https://sources.debian.org/src/glibc/2.42-13/nss/nss_fgetent_r.c/ +// and https://sources.debian.org/src/glibc/2.42-13/nss/fgetpwent_r.c/#L150-L165 +func parseParts(parts [][]byte, fields ...any) bool { + for i, v := range fields { + var p []byte + if i < len(parts) { + p = parts[i] } // Use the type of the argument to figure out how to parse it, scanf() style. // This is legit. - switch e := v[i].(type) { + switch e := v.(type) { case *string: *e = string(p) case *int: - // "numbers", with conversion errors ignored because of some misbehaving configuration files. - *e, _ = strconv.Atoi(string(p)) + // The only *int fields are UIDs and GIDs. + n, err := parseNumeric(string(p)) + if err != nil { + return false + } + *e = n case *int64: - *e, _ = strconv.ParseInt(string(p), 10, 64) + n, err := strconv.ParseInt(string(p), 10, 64) + if err != nil { + return false + } + *e = n case *[]string: - // Comma-separated lists. - if len(p) != 0 { - *e = strings.Split(string(p), ",") - } else { - *e = []string{} + // Comma-separated lists. Like glibc, skip leading whitespace + // (but keep trailing one), and drop empty elements. + // + // See https://sources.debian.org/src/glibc/2.42-13/nss/nss_files/files-parse.c/#L278-L291 + *e = []string{} + for s := range strings.SplitSeq(string(p), ",") { + if s = strings.TrimLeft(s, " \t\n\v\f\r"); s != "" { + *e = append(*e, s) + } } default: // Someone goof'd when writing code using this function. Scream so they can hear us. panic(fmt.Sprintf("parseLine only accepts {*string, *int, *int64, *[]string} as arguments! %#v is not a pointer!", e)) } } + return true } func ParsePasswdFile(path string) ([]User, error) { @@ -106,7 +129,7 @@ func ParsePasswd(passwd io.Reader) ([]User, error) { } func ParsePasswdFileFilter(path string, filter func(User) bool) ([]User, error) { - passwd, err := os.Open(path) + passwd, err := openUserFile(path) if err != nil { return nil, err } @@ -125,8 +148,9 @@ func ParsePasswdFilter(r io.Reader, filter func(User) bool) ([]User, error) { ) for s.Scan() { + // Skip blank lines and comments, like glibc does (see ParseGroupFilter). line := bytes.TrimSpace(s.Bytes()) - if len(line) == 0 { + if len(line) == 0 || line[0] == '#' { continue } @@ -136,7 +160,10 @@ func ParsePasswdFilter(r io.Reader, filter func(User) bool) ([]User, error) { // root:x:0:0:root:/root:/bin/bash // adm:x:3:4:adm:/var/adm:/bin/false p := User{} - parseLine(line, &p.Name, &p.Pass, &p.Uid, &p.Gid, &p.Gecos, &p.Home, &p.Shell) + if !parseLine(line, &p.Name, &p.Pass, &p.Uid, &p.Gid, &p.Gecos, &p.Home, &p.Shell) { + // Skip malformed lines. + continue + } if filter == nil || filter(p) { out = append(out, p) @@ -195,7 +222,10 @@ func ParseGroupFilter(r io.Reader, filter func(Group) bool) ([]Group, error) { // root:x:0:root // adm:x:4:root,adm,daemon p := Group{} - parseLine(line, &p.Name, &p.Pass, &p.Gid, &p.List) + if !parseLine(line, &p.Name, &p.Pass, &p.Gid, &p.List) { + // Skip malformed lines. + continue + } if filter == nil || filter(p) { out = append(out, p) @@ -235,33 +265,50 @@ func GetExecUserPath(userSpec string, defaults *ExecUser, passwdPath, groupPath return GetExecUser(userSpec, defaults, passwd, group) } -// parseNumeric parses the given UID or GID value to an integer and within -// the minID - maxID range. +// validateID checks whether a UID or GID is within the supported range, +// returning [ErrRange] if it is not. // -// While the Linux kernel allows the max UID to be MaxUint32 - 2, -// and the OCI Runtime Spec has no definition about the max UID, we require -// the UID to be <= MaxInt32. +// While the Linux kernel allows UIDs up to MaxUint32 - 2, and the OCI +// Runtime Spec does not define a maximum UID, we restrict IDs to MaxInt32 +// for compatibility with 32-bit systems and OCI runtimes. // // See https://github.com/containerd/containerd/commit/de1341c201ffb0effebbf51d00376181968c8779 -func parseNumeric(val string) (int, bool, error) { +func validateID(id int) error { + if id < minID || id > maxID { + return ErrRange + } + return nil +} + +// parseNumeric parses a UID or GID as an integer within the supported range. +func parseNumeric(val string) (int, error) { id, err := strconv.Atoi(val) if err != nil { - if errors.Is(err, strconv.ErrSyntax) { - // Discard the error, because non-numeric values are expected - // when passing a username or group-name. - return 0, false, nil - } if errors.Is(err, strconv.ErrRange) { - return 0, true, ErrRange + return 0, ErrRange } - // Other errors ("invalid base", "invalid bit size"); should never - // happen with strconv.Atoi. - return 0, false, err + return 0, err } - if id < minID || id > maxID { - return 0, true, ErrRange + if err := validateID(id); err != nil { + return 0, err } - return id, true, nil + return id, nil +} + +// parseMaybeNumeric parses a UID or GID as a numeric ID, or indicates +// that the value should be interpreted as a username or group name. +// +// Non-numeric values are expected when passing a username or group name, +// so syntax errors are ignored. The boolean indicates whether the value +// was interpreted as a numeric ID. +func parseMaybeNumeric(val string) (int, bool, error) { + id, err := parseNumeric(val) + if errors.Is(err, strconv.ErrSyntax) { + // Discard the error, because non-numeric values are expected + // when passing a username or group-name. + return 0, false, nil + } + return id, true, err } // GetExecUser parses a user specification string (using the passwd and group @@ -398,6 +445,9 @@ func GetAdditionalGroups(additionalGroups []string, group io.Reader) ([]int, err if err != nil { return nil, err } + if groupArg == nil { + return nil, errors.New("empty group name") + } addtlGroups = append(addtlGroups, *groupArg) } @@ -423,9 +473,6 @@ func GetAdditionalGroups(additionalGroups []string, group io.Reader) ([]int, err for _, g := range groups { if ag.matches(g) { // take the first matched group as correct - if g.Gid < minID || g.Gid > maxID { - return nil, ErrRange - } gidMap[g.Gid] = struct{}{} found = true break @@ -453,25 +500,46 @@ func GetAdditionalGroups(additionalGroups []string, group io.Reader) ([]int, err // that opens the groupPath given and gives it as an argument to // GetAdditionalGroups. func GetAdditionalGroupsPath(additionalGroups []string, groupPath string) ([]int, error) { - var group io.Reader - - if groupFile, err := os.Open(groupPath); err == nil { - group = groupFile - defer groupFile.Close() + groupFile, err := openUserFile(groupPath) + if err != nil { + if !errors.Is(err, os.ErrNotExist) { + return nil, err + } + return GetAdditionalGroups(additionalGroups, nil) } - return GetAdditionalGroups(additionalGroups, group) + defer func() { _ = groupFile.Close() }() + + return GetAdditionalGroups(additionalGroups, groupFile) } +// maxSubID is the maximum subordinate ID (maxof(id_t) in shadow-utils). +const maxSubID = 1<<32 - 1 + +// valid reports whether s is a valid subordinate ID range. It follows the +// checks done by shadow-utils: the name must not be empty, and the range +// must fit into 32-bit IDs. +// +// See https://github.com/shadow-maint/shadow/blob/24bc15eac4dcdec9c73c59988fe030b44a98c3de/lib/subordinateio.c#L93-L127 +func (s SubID) valid() bool { + return s.Name != "" && + s.SubID >= 0 && s.SubID <= maxSubID && + s.Count >= 0 && s.Count <= min(maxSubID+1-s.SubID, maxSubID) +} + +// ParseSubIDFile parses subordinate UID/GID ranges from the specified file. func ParseSubIDFile(path string) ([]SubID, error) { return ParseSubIDFileFilter(path, nil) } +// ParseSubID parses subordinate UID/GID ranges from the provided reader. func ParseSubID(subid io.Reader) ([]SubID, error) { return ParseSubIDFilter(subid, nil) } +// ParseSubIDFileFilter parses subordinate UID/GID ranges from the specified +// file, returning only entries matching filter. A nil filter matches all entries. func ParseSubIDFileFilter(path string, filter func(SubID) bool) ([]SubID, error) { - subid, err := os.Open(path) + subid, err := openUserFile(path) if err != nil { return nil, err } @@ -479,6 +547,8 @@ func ParseSubIDFileFilter(path string, filter func(SubID) bool) ([]SubID, error) return ParseSubIDFilter(subid, filter) } +// ParseSubIDFilter parses subordinate UID/GID ranges from the provided reader, +// returning only entries matching filter. A nil filter matches all entries. func ParseSubIDFilter(r io.Reader, filter func(SubID) bool) ([]SubID, error) { if r == nil { return nil, errors.New("nil source for subid-formatted data") @@ -496,8 +566,15 @@ func ParseSubIDFilter(r io.Reader, filter func(SubID) bool) ([]SubID, error) { } // see: man 5 subuid + // name:subid:count + // Name:SubID:Count + // user:100000:65536 + parts := bytes.Split(line, []byte(":")) p := SubID{} - parseLine(line, &p.Name, &p.SubID, &p.Count) + if len(parts) != 3 || !parseParts(parts, &p.Name, &p.SubID, &p.Count) || !p.valid() { + // Skip malformed lines. + continue + } if filter == nil || filter(p) { out = append(out, p) @@ -510,23 +587,36 @@ func ParseSubIDFilter(r io.Reader, filter func(SubID) bool) ([]SubID, error) { return out, nil } +// ParseIDMapFile parses ID mappings from the specified file. func ParseIDMapFile(path string) ([]IDMap, error) { return ParseIDMapFileFilter(path, nil) } +// ParseIDMap parses ID mappings from r. func ParseIDMap(r io.Reader) ([]IDMap, error) { return ParseIDMapFilter(r, nil) } +// ParseIDMapFileFilter parses ID mappings from the specified file, +// returning only entries matching filter. A nil filter matches all entries. +// Reads are limited to 10 MiB, but non-regular files are allowed to support +// procfs-backed UID/GID mapping files. func ParseIDMapFileFilter(path string, filter func(IDMap) bool) ([]IDMap, error) { - r, err := os.Open(path) + // ID mapping files are typically procfs files, so we cannot use + // openUserFile's regular-file check. Enforce the read limit separately. + f, err := os.Open(path) if err != nil { return nil, err } - defer r.Close() + + r := newLimitedFile(f) + defer func() { _ = r.Close() }() + return ParseIDMapFilter(r, filter) } +// ParseIDMapFilter parses ID mappings from r, returning only entries +// matching filter. A nil filter matches all entries. func ParseIDMapFilter(r io.Reader, filter func(IDMap) bool) ([]IDMap, error) { if r == nil { return nil, errors.New("nil source for idmap-formatted data") @@ -545,7 +635,10 @@ func ParseIDMapFilter(r io.Reader, filter func(IDMap) bool) ([]IDMap, error) { // see: man 7 user_namespaces p := IDMap{} - parseParts(bytes.Fields(line), &p.ID, &p.ParentID, &p.Count) + if !parseParts(bytes.Fields(line), &p.ID, &p.ParentID, &p.Count) { + // Skip malformed lines. + continue + } if filter == nil || filter(p) { out = append(out, p) diff --git a/vendor/github.com/moby/sys/user/user_utils.go b/vendor/github.com/moby/sys/user/user_utils.go index 8084d3b0717a..86fe8830548e 100644 --- a/vendor/github.com/moby/sys/user/user_utils.go +++ b/vendor/github.com/moby/sys/user/user_utils.go @@ -12,6 +12,8 @@ import ( // generous headroom while bounding memory usage. const maxUserFileBytes = 10 << 20 +var errNotRegularFile = errors.New("not a regular file") + // openUserFile attempts to open a user-database file with a limitedFile // capped at maxUserFileBytes. It produces an error if the given path is // a non-regular file. @@ -31,18 +33,22 @@ func openUserFile(path string) (*limitedFile, error) { return nil, &os.PathError{ Op: "open", Path: path, - Err: errors.New("not a regular file"), + Err: errNotRegularFile, } } + return newLimitedFile(f), nil +} + +func newLimitedFile(f *os.File) *limitedFile { return &limitedFile{ File: f, // Allow one byte past the cap so an overflow surfaces as an // error rather than a silent EOF that the parser would treat as // a clean end-of-file (and miss any entries past the cap). LimitedReader: &io.LimitedReader{R: f, N: maxUserFileBytes + 1}, - name: path, - }, nil + name: f.Name(), + } } type limitedFile struct { @@ -78,7 +84,7 @@ func parseUserArg(name string) (*userArg, error) { if name == "" { return nil, nil } - uid, isNumeric, err := parseNumeric(name) + uid, isNumeric, err := parseMaybeNumeric(name) if err != nil { return nil, err } @@ -109,7 +115,7 @@ func parseGroupArg(name string) (*groupArg, error) { if name == "" { return nil, nil } - gid, isNumeric, err := parseNumeric(name) + gid, isNumeric, err := parseMaybeNumeric(name) if err != nil { return nil, err } diff --git a/vendor/modules.txt b/vendor/modules.txt index 94e88ca15873..d1d2f7a9a131 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -228,7 +228,7 @@ github.com/moby/sys/signal # github.com/moby/sys/symlink v0.3.0 ## explicit; go 1.17 github.com/moby/sys/symlink -# github.com/moby/sys/user v0.5.0 +# github.com/moby/sys/user v0.5.1 ## explicit; go 1.24 github.com/moby/sys/user # github.com/moby/sys/userns v0.2.1 From a2b4053d5ddde79318a021d1eaa4d9233770a57e Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 13 Nov 2026 17:03:58 +0100 Subject: [PATCH 24/25] cli/command: reduce uses of client/pkg/progress utilities MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also suppress some unhandled errors Signed-off-by: Sebastiaan van Stijn (cherry picked from commit a9f5e8a5c3997b173e5273e5e564f8b934b41b57) Signed-off-by: Paweł Gronowski --- cli/command/service/progress/progress.go | 31 +++++++++++---------- cli/command/swarm/progress/root_rotation.go | 10 +++---- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/cli/command/service/progress/progress.go b/cli/command/service/progress/progress.go index ef191fce33ac..e52fe8bdd0b8 100644 --- a/cli/command/service/progress/progress.go +++ b/cli/command/service/progress/progress.go @@ -72,7 +72,7 @@ func terminalState(state swarm.TaskState) bool { // //nolint:gocyclo func ServiceProgress(ctx context.Context, apiClient client.APIClient, serviceID string, progressWriter io.WriteCloser) error { - defer progressWriter.Close() + defer func() { _ = progressWriter.Close() }() progressOut := streamformatter.NewJSONProgressOutput(progressWriter, false) @@ -118,7 +118,7 @@ func ServiceProgress(ctx context.Context, apiClient client.APIClient, serviceID return fmt.Errorf("service update paused: %s", res.Service.UpdateStatus.Message) case swarm.UpdateStateRollbackStarted: if !rollback && res.Service.UpdateStatus.Message != "" { - progressOut.WriteProgress(progress.Progress{ + _ = progressOut.WriteProgress(progress.Progress{ ID: "rollback", Action: res.Service.UpdateStatus.Message, }) @@ -169,7 +169,7 @@ func ServiceProgress(ctx context.Context, apiClient client.APIClient, serviceID // use the presence of this field to check if the service is a job // here. if res.Service.JobStatus != nil { - progress.Message(progressOut, "", "job complete") + _ = progressOut.WriteProgress(progress.Progress{Message: "job complete"}) return nil } @@ -205,8 +205,8 @@ func ServiceProgress(ctx context.Context, apiClient client.APIClient, serviceID case <-time.After(200 * time.Millisecond): case <-sigint: if !converged { - progress.Message(progressOut, "", "Operation continuing in background.") - progress.Messagef(progressOut, "", "Use `docker service ps %s` to check progress.", serviceID) + _ = progressOut.WriteProgress(progress.Progress{Message: "Operation continuing in background."}) + _ = progressOut.WriteProgress(progress.Progress{Message: fmt.Sprintf("Use `docker service ps %s` to check progress.", serviceID)}) } return nil } @@ -255,13 +255,13 @@ func initializeUpdater(service swarm.Service, progressOut progress.Output) (prog func writeOverallProgress(progressOut progress.Output, numerator, denominator int, rollback bool) { if rollback { - progressOut.WriteProgress(progress.Progress{ + _ = progressOut.WriteProgress(progress.Progress{ ID: "overall progress", Action: fmt.Sprintf("rolling back update: %d out of %d tasks", numerator, denominator), }) return } - progressOut.WriteProgress(progress.Progress{ + _ = progressOut.WriteProgress(progress.Progress{ ID: "overall progress", Action: fmt.Sprintf("%d out of %d tasks", numerator, denominator), }) @@ -305,7 +305,10 @@ func (u *replicatedProgressUpdater) update(service swarm.Service, tasks []swarm. if replicas <= maxProgressBars { for i := uint64(1); i <= replicas; i++ { - progress.Update(u.progressOut, fmt.Sprintf("%d/%d", i, replicas), " ") + _ = u.progressOut.WriteProgress(progress.Progress{ + ID: fmt.Sprintf("%d/%d", i, replicas), + Action: " ", + }) } } u.initialized = true @@ -388,7 +391,7 @@ func (u *replicatedProgressUpdater) writeTaskProgress(task swarm.Task, mappedSlo } if task.Status.Err != "" { - u.progressOut.WriteProgress(progress.Progress{ + _ = u.progressOut.WriteProgress(progress.Progress{ ID: fmt.Sprintf("%d/%d", mappedSlot, replicas), Action: truncError(task.Status.Err), }) @@ -396,7 +399,7 @@ func (u *replicatedProgressUpdater) writeTaskProgress(task swarm.Task, mappedSlo } if !terminalState(task.DesiredState) && !terminalState(task.Status.State) { - u.progressOut.WriteProgress(progress.Progress{ + _ = u.progressOut.WriteProgress(progress.Progress{ ID: fmt.Sprintf("%d/%d", mappedSlot, replicas), Action: fmt.Sprintf("%-[1]*s", longestState, task.Status.State), Current: numberedStates[task.Status.State], @@ -427,7 +430,7 @@ func (u *globalProgressUpdater) update(_ swarm.Service, tasks []swarm.Task, acti // Two possibilities: either the orchestrator hasn't created // the tasks yet, or the service doesn't meet constraints for // any node. Either way, we wait. - u.progressOut.WriteProgress(progress.Progress{ + _ = u.progressOut.WriteProgress(progress.Progress{ ID: "overall progress", Action: "waiting for new tasks", }) @@ -505,7 +508,7 @@ func (u *globalProgressUpdater) writeTaskProgress(task swarm.Task, nodeCount int } if task.Status.Err != "" { - u.progressOut.WriteProgress(progress.Progress{ + _ = u.progressOut.WriteProgress(progress.Progress{ ID: formatter.TruncateID(task.NodeID), Action: truncError(task.Status.Err), }) @@ -513,7 +516,7 @@ func (u *globalProgressUpdater) writeTaskProgress(task swarm.Task, nodeCount int } if !terminalState(task.DesiredState) && !terminalState(task.Status.State) { - u.progressOut.WriteProgress(progress.Progress{ + _ = u.progressOut.WriteProgress(progress.Progress{ ID: formatter.TruncateID(task.NodeID), Action: fmt.Sprintf("%-[1]*s", longestState, task.Status.State), Current: numberedStates[task.Status.State], @@ -593,7 +596,7 @@ func (u *replicatedJobProgressUpdater) update(_ swarm.Service, tasks []swarm.Tas // only write out progress bars if there will be less than the maximum if u.total <= maxProgressBars { for i := 1; i <= u.total; i++ { - u.progressOut.WriteProgress(progress.Progress{ + _ = u.progressOut.WriteProgress(progress.Progress{ ID: fmt.Sprintf("%d/%d", i, u.total), Action: " ", }) diff --git a/cli/command/swarm/progress/root_rotation.go b/cli/command/swarm/progress/root_rotation.go index 54e53e55d960..ea0e069bfb69 100644 --- a/cli/command/swarm/progress/root_rotation.go +++ b/cli/command/swarm/progress/root_rotation.go @@ -37,9 +37,9 @@ func RootRotationProgress(ctx context.Context, apiClient client.APIClient, progr defer signal.Stop(sigint) // draw 2 progress bars, 1 for nodes with the correct cert, 1 for nodes with the correct trust root - progress.Update(progressOut, "desired root digest", "") - progress.Update(progressOut, certsRotatedStr, certsAction) - progress.Update(progressOut, rootsRotatedStr, rootsAction) + _ = progressOut.WriteProgress(progress.Progress{ID: "desired root digest"}) + _ = progressOut.WriteProgress(progress.Progress{ID: certsRotatedStr, Action: certsAction}) + _ = progressOut.WriteProgress(progress.Progress{ID: rootsRotatedStr, Action: rootsAction}) var done bool @@ -64,8 +64,8 @@ func RootRotationProgress(ctx context.Context, apiClient client.APIClient, progr case <-time.After(200 * time.Millisecond): case <-sigint: if !done { - progress.Message(progressOut, "", "Operation continuing in background.") - progress.Message(progressOut, "", "Use `swarmctl cluster inspect default` to check progress.") + _ = progressOut.WriteProgress(progress.Progress{Message: "Operation continuing in background."}) + _ = progressOut.WriteProgress(progress.Progress{Message: "Use `swarmctl cluster inspect default` to check progress."}) } return nil } From 8b46f3f028d58597b587ae6ea233420a11902317 Mon Sep 17 00:00:00 2001 From: "Jonathan A. Sternberg" Date: Tue, 24 Nov 2026 10:37:25 -0600 Subject: [PATCH 25/25] fix: suppress printing the newline when a status error has no output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a `cli.StatusError` was returned by a plugin, the error would be printed with `Fprintln` even if the message was empty. This avoids the call entirely if `cli.StatusError` is returned and the error text is empty to allow plugins to return non-zero exit statuses without printing anything. Signed-off-by: Jonathan A. Sternberg (cherry picked from commit b0a3c17cd8a73d6f24535c0f5825f038cb4f744a) Signed-off-by: Paweł Gronowski --- cli-plugins/plugin/plugin.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cli-plugins/plugin/plugin.go b/cli-plugins/plugin/plugin.go index d4dfb5ade29c..11100f8d6803 100644 --- a/cli-plugins/plugin/plugin.go +++ b/cli-plugins/plugin/plugin.go @@ -166,7 +166,11 @@ func Run(makeCmd func(command.Cli) *cobra.Command, meta metadata.Metadata, ops . if stErr.StatusCode == 0 { // FIXME(thaJeztah): this should never be used with a zero status-code. Check if we do this anywhere. stErr.StatusCode = 1 } - _, _ = fmt.Fprintln(dockerCLI.Err(), stErr) + + // Only print the message if the error has text. + if msg := stErr.Error(); msg != "" { + _, _ = fmt.Fprintln(dockerCLI.Err(), msg) + } os.Exit(stErr.StatusCode) } _, _ = fmt.Fprintln(dockerCLI.Err(), err)