You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ContainerRegistry: Reject invalid image tags and digests (#140)
Motivation
----------
`ImageReference` does not check for illegal characters in parsed image
digests and tags. 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.
Some desktop runtimes accept local image names which the registry will
reject; other runtimes reject these names even for local names.
`containertool`
now also rejects them.
Modifications
-------------
* Check validity of tags and digests when parsing image names
* Change the low-level API functions to accept `Digest` or `Reference`
instead of `String`.
Result
------
It is impossible to create a `Repository` object containing a malformed
tag or digest, because the constructor checks the string value. It is
impossible
to send a malformed name to the registry because the API wrappers only
accept `Digest` or `Reference (Digest | Tag)` objects.
Fixes#139
Test Plan
---------
Existing tests continue to pass.
New tests exercise additional checks which were previously missing.
Removed tests which checked tags which seemed to be accepted by some
desktop runtimes, but which were not accepted by registries.
Copy file name to clipboardExpand all lines: Sources/ContainerRegistry/RegistryClient+ImageConfiguration.swift
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,8 @@ extension RegistryClient {
21
21
/// - Throws: If the blob cannot be decoded as an `ImageConfiguration`.
22
22
///
23
23
/// Image configuration records are stored as blobs in the registry. This function retrieves the requested blob and tries to decode it as a configuration record.
0 commit comments