42 Commits

Author SHA1 Message Date
alhudz
2f69dbfde1 fix contentRangeRegexp to accept unknown total size
Signed-off-by: alhudz <al.hudz.k@gmail.com>
2026-06-19 17:15:54 +05:30
Milos Gajdos
0d5789588f chore: smol go fix changes
This PR changes the code based on the `go fix` suggestions
to modernize the codebase and keep up with the latest Go features.

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2026-05-24 15:56:02 -07:00
Milos Gajdos
ca7d4de0ee fix(proxy): fix tag list endpoint in proxy mode (#4846) 2026-04-16 14:17:56 -07:00
Milos Gajdos
ece70d987f refactor: use slices.Backward to simplify the code (#4848) 2026-04-16 14:17:33 -07:00
Milos Gajdos
6ae29aadd7 internal/client/auth/challenge: cleanups and minor refactor (#4832) 2026-04-12 16:09:55 -07:00
chuanshanjida
0679fc13c5 refactor: use slices.Backward to simplify the code
Signed-off-by: chuanshanjida <chuanshanjida@outlook.com>
2026-04-12 16:01:45 +08:00
njucjc
60de6e3443 fix(proxy): fix tag list endpoint in proxy mode
Signed-off-by: njucjc <njucjc@alibaba-inc.com>
Signed-off-by: chenjinci.cjc <chenjinci.cjc@alibaba-inc.com>
2026-04-09 23:30:51 +08:00
Milos Gajdos
cc5d5fa4ba Merge commit from fork
proxy: bind bearer realms to upstream trust boundary
2026-04-05 13:30:20 -07:00
1seal
f215e513de proxy: bind bearer realms to upstream trust boundary
bind proxy-mode bearer realms to the upstream trust boundary before sending credentials, move challenge filtering behind the auth manager, and use golang.org/x/net/publicsuffix for registrable-domain handling.
2026-03-30 18:27:47 +03:00
Sebastiaan van Stijn
3c670635c2 internal/client/auth/challenge: fix minor linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-28 17:47:03 +01:00
Sebastiaan van Stijn
055cc71b4e internal/client/auth/challenge: cleanup URL-normalization
- change normalizeURL to not mutate the input URL.
- move lowercasing into canonicalAddr.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-28 17:46:02 +01:00
Sebastiaan van Stijn
a35ff435a6 internal/client/auth/challenge: simpleManager: make zero value usable
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-28 17:09:35 +01:00
Sebastiaan van Stijn
069947f6fd internal/client/auth/challenge: simpleManager: un-export fields
Un-export the mutex and Challenges field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-28 17:09:04 +01:00
ChandonPierre
e0bac48375 fix(registry/proxy): do not re-use http request context for background writes
Signed-off-by: Chandon Pierre <cpierre@coreweave.com>
2026-03-27 18:19:47 -04:00
Milos Gajdos
7a7c44d3f9 Opt: refector tag list pagination support (stage 1) (#4360) 2026-03-25 09:55:09 -07:00
Sebastiaan van Stijn
775d3734eb modernize code
Automated fixing, using Go's "modernize" tool;

    go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest
    modernize -fix ./...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-02-12 18:28:58 +01:00
Sebastiaan van Stijn
f5e1a8931a update golangci-lint to v2.9 and fix linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-02-11 10:10:07 +01:00
njucjc
b1ae1b211e Opt: refector tag list pagination support
Signed-off-by: njucjc <njucjc@gmail.com>
2026-01-28 11:39:06 +08:00
efcking
64f4511a27 refactor: remove redundant variable declarations in for loops
Signed-off-by: efcking <efcking@outlook.com>
2025-11-19 12:01:28 +08:00
Artem Tkachuk
2f1a51dc72 client: add Accept headers to Exists() HEAD
The manifest Exists() client call issued a HEAD without any Accept
headers. Some OCI-focused registries require an explicit Accept for
manifest content negotiation, causing HEAD to fail (404/406) even
when the manifest exists. The Get() path already sets Accept;
Exists() did not.

This change adds all supported manifest media types from
distribution.ManifestMediaTypes() as Accept headers to the Exists()
HEAD request, aligning behavior with Get() and improving OCI
interoperability.

Tests:
- Regression: Exists() returns true when Accept is present and
  false when stripped (negative path), mirroring real-world
  behavior.

Risk/compatibility:
- Low. Registries that ignore Accept on HEAD continue to work.
- Redirect handling is unchanged; existing CheckRedirect preserves
  Accept.

Signed-off-by: Artem Tkachuk <artemtkachuk@yahoo.com>
2025-10-13 23:52:12 -07:00
Wang Yan
f6e54e6189 refactor: replace map iteration with maps.Copy/Clone (#4632) 2025-08-11 13:28:07 +08:00
Raj Siva-Rajah
b559f27a08 Switch to UUIDv7
Signed-off-by: Raj Siva-Rajah <raj@zapzap.cloud>
2025-07-31 06:54:27 +00:00
whosehang
fea3638384 refactor: replace map iteration with maps.Copy/Clone
Signed-off-by: whosehang <whosehang@outlook.com>
2025-05-03 09:24:10 +08:00
Vadim Bauer
19934b8fd3 fix: leak
resolves #4494 replaces #4567

Signed-off-by: Vadim Bauer <vb@container-registry.com>
2025-03-20 18:23:43 +01:00
Sebastiaan van Stijn
0ab7f326e6 replace uses of Descriptor alias
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-07 13:07:47 +02:00
Milos Gajdos
a940e61623 Fix silly testing format mistakes
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2024-08-30 11:18:18 +01:00
Sebastiaan van Stijn
1e89cf780c deprecate Versioned in favor of oci.Versioned
Update the Manifest types to use the oci implementation of the Versioned
struct.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-18 18:38:32 +02:00
Markus Thömmes
e8820b2564 Don't try to parse error responses with no body
HEAD requests for instance return no body while still having all the relevant Content-Type headers set, causing unnecessary parsing errors. This skips further parsing for all requests that don't have any body to begin with.

Signed-off-by: Markus Thömmes <markusthoemmes@me.com>
2024-03-20 11:46:14 +01:00
guoguangwu
a4918b67bb fix: typo
Signed-off-by: guoguangwu <guoguangwug@gmail.com>
2024-03-04 11:00:08 +08:00
Sebastiaan van Stijn
5033279355 remove deprecated ReadSeekCloser interfaces
These were deprecated in 019ead86f5 and
d71ad5b3a6, and are no longer in use in
our code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-01-06 12:08:21 +01:00
Milos Gajdos
d5a1cf6816 cleanup: move init funcs to the top of the source (#4172) 2023-12-01 06:59:35 +00:00
Milos Gajdos
b3681c4cd3 feat: add tparallel linter to improve handling parallel tests
This linter both prevents parallel test races as well as
suggests parallel tests where appropriate:
See: https://github.com/moricho/tparallel

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2023-11-29 21:40:20 +00:00
Milos Gajdos
f71b32894a remove uuid package (#4157) 2023-11-29 17:42:51 +00:00
Milos Gajdos
d8ff41a344 cleanup: move init funcs to the top of the source
We make sure they're not hiding at the bottom or in the middle
which makes debugging an utter nightmare!

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2023-11-28 06:50:48 +00:00
Milos Gajdos
f33e5a69da fix: invalid conversion when using Content-Range in client
Fixes: https://github.com/distribution/distribution/security/code-scanning/34

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2023-11-22 07:02:01 +00:00
gotgelf
bb15625561 remove uuid package
the `uuid` package is not used in the code base,
so it can be safely remove.

Signed-off-by: Alex Gotgelf <gotgelf@gmail.com>
Signed-off-by: gotgelf <gotgelf@gmail.com>
2023-11-16 08:55:58 +01:00
Cory Snider
f7e5eaae70 internal/dcontext: drop GetRequest() function
It is no longer used.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-10-27 10:58:37 -04:00
Cory Snider
9157226e7b Extract request utilities into its own package
The RemoteAddr and RemoteIP functions operate on *http.Request values,
not contexts. They have very low cohesion with the rest of the package.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-10-27 10:58:37 -04:00
Cory Snider
d0f5aa670b Move context package internal
Our context package predates the establishment of current best practices
regarding context usage and it shows. It encourages bad practices such
as using contexts to propagate non-request-scoped values like the
application version and using string-typed keys for context values. Move
the package internal to remove it from the API surface of
distribution/v3@v3.0.0 so we are free to iterate on it without being
constrained by compatibility.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-10-27 10:58:37 -04:00
James Hewitt
ef8651ec2a Switch to github.com/google/uuid
Signed-off-by: James Hewitt <james.hewitt@uk.ibm.com>
2023-10-25 12:15:21 +01:00
Cory Snider
8a86dc61ff Make our UUID package internal
Nowadays there are much, much better UUID implementations to choose
from, such as github.com/google/uuid. Prevent external users from
importing our bespoke implementation so that we can change or migrate
away from it internally without introducing breaking changes.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-10-24 18:11:41 -04:00
Cory Snider
cc23fdacff Move registry client internal
Our registry client is not currently in a good place to be used as the
reference OCI Distribution client implementation. But the registry proxy
currently depends on it. Make the registry client internal to the
distribution application to remove it from the API surface area (and any
implied compatibility promises) of distribution/v3@v3.0.0 without
breaking the proxy.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-10-24 12:26:38 -04:00