oras-project / oras-go

ORAS Go library
https://oras.land
Apache License 2.0
181 stars 98 forks source link

Support narrowly scoped registry authentication #840

Open arewm opened 1 week ago

arewm commented 1 week ago

Global access might not be granted for an entire registry. Instead, multiple service accounts/robots may be used for narrowly scoped push/pull actions. Registry authentication should be done from most-specific to least-specific.

When checking for available credentials, the relevant repository is matched against available keys in its hierarchical order, going from most-specific to least-specific. For example, an image pull for my-registry.local/namespace/user/image:latest will result in a lookup in auth.json in the following order:

  • my-registry.local/namespace/user/image
  • my-registry.local/namespace/user
  • my-registry.local/namespace
  • my-registry.local

https://github.com/containers/image/blob/main/docs/containers-auth.json.5.md#format

This is similar to the proposed change in https://github.com/google/go-containerregistry/pull/1966.

shizhMSFT commented 1 week ago

Related to #836

shizhMSFT commented 1 week ago

This requires a redesign of the auth module, which further requires a design revisit.