Commit graph

2803 commits

Author SHA1 Message Date
Milos Gajdos
1eb2c30122
Merge pull request #4068 from milosgajdos/2_8-dont-close-request-body
[release/2.8] Do not close HTTP request body in HTTP handler
2023-09-23 23:08:31 +01:00
Milos Gajdos
5e6b1b5c98
Do not close HTTP request body in HTTP handler
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2023-09-22 16:50:30 +01:00
Milos Gajdos
2b76378843
Merge pull request #4064 from thaJeztah/2.8_backport_nodigestset
[release/2.8] digestset: deprecate package in favor of go-digest/digestset
2023-09-22 14:35:45 +01:00
Sebastiaan van Stijn
29b00e8b28
digestset: deprecate package in favor of go-digest/digestset
This package was only used for the deprecated "shortid" syntax. Now that
support for this syntax was removed, we can also remove this package.

This patch deprecates and removes the package, adding temporary aliases pointing
to the new location to ease migration from docker/distribution to the new
distribution/distribution/v3. We should remove those aliases in a future update.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 7b651a9692)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-22 15:23:11 +02:00
Sebastiaan van Stijn
d1ab2430e6
[release/2.8] vendor: github.com/opencontainers/go-digest v1.0.0
full diff: a6d0ee40d4...v1.0.0

This is similar to the same changes on main:

- bf56f348be (update to v1.0.0-rc1)
- 8a8d91529d (update to v1.0.0)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-22 15:23:08 +02:00
Milos Gajdos
11eb4194f6
Merge pull request #4063 from thaJeztah/2.8_backport_switch_reference
[release/2.8] deprecate reference package, migrate to github.com/distribution/reference
2023-09-22 14:21:53 +01:00
Sebastiaan van Stijn
3dda067747
deprecate reference package, migrate to github.com/distribution/reference
This integrates the new module, which was extracted from this repository
at commit b9b19409cf458dcb9e1253ff44ba75bd0620faa6;

    # install filter-repo (https://github.com/newren/git-filter-repo/blob/main/INSTALL.md)
    brew install git-filter-repo

    # create a temporary clone of docker
    cd ~/Projects
    git clone https://github.com/distribution/distribution.git reference
    cd reference

    # commit taken from
    git rev-parse --verify HEAD
    b9b19409cf

    # remove all code, except for general files, 'reference/', and rename to /
    git filter-repo \
      --path .github/workflows/codeql-analysis.yml \
      --path .github/workflows/fossa.yml \
      --path .golangci.yml \
      --path distribution-logo.svg \
      --path CODE-OF-CONDUCT.md \
      --path CONTRIBUTING.md \
      --path GOVERNANCE.md \
      --path README.md \
      --path LICENSE \
      --path MAINTAINERS \
      --path-glob 'reference/*.*' \
      --path-rename reference/:

    # initialize go.mod
    go mod init github.com/distribution/reference
    go mod tidy -go=1.20

This commit is based on 152af63ec5 in the main branch,
but adjusted for the 2.8 branch, with some differences:

- the Sort functions have not been kept, as they were not part of the v2 package,
  and introduced in 1052518d9f
- the ParseAnyReferenceWithSet and ShortIdentifierRegexp were kept (but deprecated)
  as removing happened in 6d4f62d7fd, which is not
  in the 2.8 branch.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-22 13:25:01 +02:00
Milos Gajdos
da05539ad3
Merge pull request #4053 from thaJeztah/2.8_backport_set-content-type-client-readfrom 2023-09-14 20:32:54 +01:00
Milos Gajdos
0fd0b73b61
Merge pull request #4056 from thaJeztah/2.8_backport_update_golang_1.20.8 2023-09-14 20:32:11 +01:00
Sebastiaan van Stijn
3c6f778842
update to go1.20.8
go1.20.8 (released 2023-09-06) includes two security fixes to the html/template
package, as well as bug fixes to the compiler, the go command, the runtime,
and the crypto/tls, go/types, net/http, and path/filepath packages. See the
Go 1.20.8 milestone on our issue tracker for details:

https://github.com/golang/go/issues?q=milestone%3AGo1.20.8+label%3ACherryPickApproved

full diff: https://github.com/golang/go/compare/go1.20.7...go1.20.8

From the security mailing:

[security] Go 1.21.1 and Go 1.20.8 are released

Hello gophers,

We have just released Go versions 1.21.1 and 1.20.8, minor point releases.

These minor releases include 4 security fixes following the security policy:

- cmd/go: go.mod toolchain directive allows arbitrary execution
  The go.mod toolchain directive, introduced in Go 1.21, could be leveraged to
  execute scripts and binaries relative to the root of the module when the "go"
  command was executed within the module. This applies to modules downloaded using
  the "go" command from the module proxy, as well as modules downloaded directly
  using VCS software.

  Thanks to Juho Nurminen of Mattermost for reporting this issue.

  This is CVE-2023-39320 and Go issue https://go.dev/issue/62198.

- html/template: improper handling of HTML-like comments within script contexts
  The html/template package did not properly handle HMTL-like "<!--" and "-->"
  comment tokens, nor hashbang "#!" comment tokens, in <script> contexts. This may
  cause the template parser to improperly interpret the contents of <script>
  contexts, causing actions to be improperly escaped. This could be leveraged to
  perform an XSS attack.

  Thanks to Takeshi Kaneko (GMO Cybersecurity by Ierae, Inc.) for reporting this
  issue.

  This is CVE-2023-39318 and Go issue https://go.dev/issue/62196.

- html/template: improper handling of special tags within script contexts
  The html/template package did not apply the proper rules for handling occurrences
  of "<script", "<!--", and "</script" within JS literals in <script> contexts.
  This may cause the template parser to improperly consider script contexts to be
  terminated early, causing actions to be improperly escaped. This could be
  leveraged to perform an XSS attack.

  Thanks to Takeshi Kaneko (GMO Cybersecurity by Ierae, Inc.) for reporting this
  issue.

  This is CVE-2023-39319 and Go issue https://go.dev/issue/62197.

- crypto/tls: panic when processing post-handshake message on QUIC connections
  Processing an incomplete post-handshake message for a QUIC connection caused a panic.

  Thanks to Marten Seemann for reporting this issue.

  This is CVE-2023-39321 and CVE-2023-39322 and Go issue https://go.dev/issue/62266.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 23115ff634)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-12 00:35:59 +02:00
James Hewitt
31f5cd4865
Handle rand deprecations in go 1.20
Signed-off-by: James Hewitt <james.hewitt@uk.ibm.com>
(cherry picked from commit 1a3e73cb84)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-12 00:35:52 +02:00
James Hewitt
29b8ba0b93
Update to go 1.20
Signed-off-by: James Hewitt <james.hewitt@uk.ibm.com>
(cherry picked from commit 0eb8fee87e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-12 00:35:05 +02:00
Ben Manuel
3316b19810
Update to golang 1.19.10
This addresses CVE-2023-29402, CVE-2023-29403, CVE-2023-29404, CVE-2023-29405
which were patched in 1.19.10.

Signed-off-by: Ben Manuel <ben.manuel@procore.com>
(cherry picked from commit 36dd5b79ca)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-12 00:35:05 +02:00
Sebastiaan van Stijn
444d053e12
update golangci-lint to v1.52
Removing the "structcheck" and "varcheck" linters as they've been deprecated.

    level=warning msg="[runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused."
    level=warning msg="[runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused."

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit dec03ea3d8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-12 00:34:52 +02:00
Sebastiaan van Stijn
b800af4409
ignore SA1019: ac.(*accessController).rootCerts.Subjects has been deprecated
We need to look into this; can we remove it, or is there a replacement?

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ebe9d67446)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-12 00:33:27 +02:00
Sebastiaan van Stijn
0a98a00d17
Ignore SA1019: SplitHostname is deprecated.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 84a85a4048)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-12 00:32:54 +02:00
Hayley Swimelar
2897284284
Merge pull request #4054 from thaJeztah/2.8_backport_nonjson-error-client
[release/2.8 backport] Dont parse errors as JSON unless Content-Type is set to JSON
2023-09-11 13:18:23 -07:00
Milos Gajdos
2ec0471bb5
Dont parse errors as JSON unless Content-Type is set to JSON
Client attempts to parse the body of every error it receives as JSON
regardless of the content-type. This commit rectifies by only parsing
he error body as JSON if the Content-Type header is set to
either "application/json" or "application/vnd.api+json".

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
(cherry picked from commit 45b7b9cec3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-08 14:54:21 +02:00
Milos Gajdos
cb121c3f20
Set Content-Type header in registry client ReadFrom
Client ReadFrom doesn't set Content-Type header leading to server
side implementor to assume it's application/octet-stream. This commit
makes this explicit on the client side.

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
(cherry picked from commit 24de708d22)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-08 14:45:13 +02:00
Milos Gajdos
10a7e4c483
Merge pull request #4032 from thaJeztah/2.8_backport_ref_replace_deprecated
[release/2.8 backport] reference: replace deprecated function SplitHostname
2023-08-31 15:20:59 +01:00
Sebastiaan van Stijn
b57133cc21
referene: fix formatting of "deprecated" comment.
Go requires "deprecated" comments to have an empty line before them,
and to not be all-caps.

This updates to the comment so that it's correctly picked up as deprecated.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 3c71f4933d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-31 12:58:15 +02:00
zounengren
2c4bf1a664
replace deprecated function
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 79d1901549)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-31 12:58:04 +02:00
Milos Gajdos
27206bcd3b
Merge pull request #4009 from thaJeztah/2.8_backport_enable_build_tags
[release/2.8 backport] Enable Go build tags
2023-08-22 15:10:59 +01:00
Milos Gajdos
110cb7538d
Enable build tags in 2.8
It would appear we were missing the Go build tags on 2.8.X branch so the
images would not have the necessary support for some storage drivers
causing breakages to end users trying to use them.

This commit fixes both the build and linting issues.

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2023-08-21 13:58:10 +02:00
Sebastiaan van Stijn
2d62a4027a
s3: add interface assertion
This was added for the other drivers in 6b388b1ba6,
but it missed the s3 storage driver.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 5b3be39870)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-21 13:57:02 +02:00
Milos Gajdos
2548973b1d
Enable Go build tags
This enables go build tags so the GCS and OSS driver support is
available in the binary distributed via the image build by Dockerfile.

This led to quite a few fixes in the GCS and OSS packages raised as
warning by golang-ci linter.

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
(cherry picked from commit 6b388b1ba6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-21 13:50:24 +02:00
Milos Gajdos
8728c52ef2
Merge pull request #3926 from marcusirgens/use-build-tags
Pass `BUILDTAGS` argument to `go build`
2023-06-07 09:53:15 +01:00
Marcus Pettersen Irgens
ab7178cc0a
Pass BUILDTAGS argument to go build
Signed-off-by: Marcus Pettersen Irgens <m@mrcus.dev>
2023-05-19 18:38:27 +02:00
Milos Gajdos
7c354a4b40
Merge pull request #3915 from distribution/2.8.2-release-notes
Add v2.8.2 release notes
2023-05-11 11:11:57 +01:00
Milos Gajdos
a173a9c625
Add v2.8.2 release notes
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2023-05-11 10:47:17 +01:00
Milos Gajdos
4894d35ecc
Merge pull request #3914 from vvoland/handle-forbidden-28
[release/2.8 backport] registry/errors: Parse http forbidden as denied
2023-05-11 10:00:25 +01:00
Milos Gajdos
f067f66d3d
Merge pull request #3783 from ndeloof/accept-encoding-28
[release/2.8 backport] revert "registry/client: set Accept: identity header when getting layers
2023-05-11 09:54:18 +01:00
Paweł Gronowski
483ad69da3
registry/errors: Parse http forbidden as denied
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 5f1df02149)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-05-11 10:45:46 +02:00
Nicolas De Loof
2b0f84df21
Revert "registry/client: set Accept: identity header when getting layers"
This reverts commit 16f086a0ec.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-10 23:00:15 +02:00
Milos Gajdos
320d6a141f
Merge pull request #3912 from distribution/2.8.2-beta.2-release-notes
Add 2.8.2 beta.2 release notes
2023-05-10 00:16:38 +01:00
Milos Gajdos
5f3ca1b2fb
Add release notes for 2.8.2-beta.2 release
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2023-05-10 00:12:20 +01:00
Milos Gajdos
cb840f63b3
Merge pull request #3911 from thaJeztah/2.8_backport_fix_releaser_filenames
[release/2.8 backport] Dockerfile: fix filenames of artifacts
2023-05-09 23:43:34 +01:00
Sebastiaan van Stijn
e884644fff
Dockerfile: fix filenames of artifacts
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 435c7b9a7b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-10 00:27:45 +02:00
Milos Gajdos
963c19952a
Merge pull request #3909 from distribution/2.8.2-beta-release-notes
Add 2.8.2-beta.1 release notes
2023-05-09 22:39:59 +01:00
Milos Gajdos
ac6c72b25f
Add 2.8.2-beta.1 release notes
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2023-05-09 22:22:05 +01:00
Milos Gajdos
dcb637d6ea
Merge pull request from GHSA-hqxw-f8mx-cpmw
[release/2.8] Fix runaway allocation on /v2/_catalog
2023-05-09 21:21:54 +01:00
Milos Gajdos
08f5645587
Merge pull request #3893 from pluralsh/part-pagination
[release/2.8] Add code to handle pagination of parts. Fixes max layer size of 10GB bug
2023-05-09 20:58:24 +01:00
Milos Gajdos
4a35c451a0
Merge pull request #3908 from thaJeztah/2.8_backport_bump_go1.19.9
[release/2.8 backport] update to go1.19.9
2023-05-09 19:16:47 +01:00
Milos Gajdos
ae58bde985
Fix gofmt warnings
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2023-05-09 18:58:38 +01:00
Sebastiaan van Stijn
3f2a4e24a7
update to go1.19.9
Added back minor versions in these, so that we have a somewhat more
reproducible state in the repository when tagging releases.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 322eb4eecf)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-09 17:57:57 +02:00
Sebastiaan van Stijn
9c04409fdb
[release/2.8] ignore deprecation of io/ioutil
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-09 17:57:28 +02:00
Milos Gajdos
b791fdc2c6
Merge pull request #3907 from thaJeztah/2.8_backport_update_xx
[release/2.8 backport] Dockerfile: update xx to v1.2.1
2023-05-09 15:58:05 +01:00
Sebastiaan van Stijn
3d8f3cc4a5
Dockerfile: update xx to v1.2.1
full diff: https://github.com/tonistiigi/xx/compare/v1.1.1...v1.2.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8c4d2b9d65)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-09 15:32:28 +02:00
Milos Gajdos
d3fac541b1
Merge pull request #3903 from thaJeztah/2.8_bump_go_118
[release/2.8] bump up golang version (alternative)
2023-05-09 13:59:02 +01:00
Wang Yan
70db3a46d9
bump up golang version
upgrade go version to v1.18.8

Signed-off-by: Wang Yan <wangyan@vmware.com>
2023-05-09 10:59:43 +02:00