Skip to content

Conversation

@euanh
Copy link
Collaborator

@euanh euanh commented Jul 1, 2025

Motivation

Cherry pick of #138.

ImageReference does not check for illegal characters in parsed image references. This means that containertool will send illegal image names to the registry. The registry will reject them, but the error message might not explain why, so a generic error message will be printed. Runtimes reject illegal image references immediately, without sending them to the registry.

Modifications

  • Introduce a Repository wrapper type
  • Check validity when constructing the Repository
  • Change the low-level API functions to accept Repository instead of String.

Result

It is impossible to create a Repository object containing a malformed name, because the constructor checks the string value. It is impossible to send a malformed name to the registry because the API wrappers only accept Repository objects.

Fixes #135

Test Plan

Existing tests continue to pass.
New tests exercise additional checks which were previously missing.

Motivation
----------

`ImageReference` does not check for illegal characters in parsed image
references. This means that `containertool` will send illegal image
names to the registry. The registry will reject them, but the error
message might not explain why, so a generic error message will be
printed. Runtimes reject illegal image references immediately, without
sending them to the registry.

Modifications
-------------

* Introduce a `Repository` wrapper type
* Check validity when constructing the `Repository`
* Change the low-level API functions to accept `Repository` instead of
`String`.

Result
------

It is impossible to create a `Repository` object containing a malformed
name, because the constructor checks the string value. It is impossible
to send a malformed name to the registry because the API wrappers only
accept `Repository` objects.

Fixes apple#135 

Test Plan
---------

Existing tests continue to pass.
New tests exercise additional checks which were previously missing.
@euanh euanh changed the title cherry-pick: ContainerRegistry: Reject invalid repository names (#138) cherry-pick: ContainerRegistry: Reject invalid repository names Jul 1, 2025
@euanh euanh added semver/patch No public API change. kind/cherry-pick Back-port changes from one release or branch to another kind/bug Something isn't working labels Jul 1, 2025
@euanh euanh merged commit 0658594 into apple:release/1.0 Jul 1, 2025
23 checks passed
@euanh euanh deleted the cherry-pick-validate-repository-names branch July 1, 2025 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working kind/cherry-pick Back-port changes from one release or branch to another semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant