ContainerizationOCI: raise Reference name limit to 255 to match OCI spec#541
Merged
dcantah merged 1 commit intoapple:mainfrom Feb 20, 2026
Merged
Conversation
The OCI distribution spec allows repository names (domain + path) of up to 255 bytes. The previous hard-coded limit of 127 characters incorrectly rejected valid references that use long registry hostnames or deep path hierarchies. Changes: - nameTotalLengthMax: 127 → 255 (OCI spec maximum for name component) - referenceTotalLengthMax: now computed as nameTotalLengthMax (255) + separator (1) + tagLengthMax (128) = 384, accommodating a full reference with the maximum name and the maximum tag length. - Added tests for names of 128 and 255 characters (both now valid) and for names of 256 characters (still rejected). Closes apple#453
Contributor
|
@cluster2600 Thank you for the submission! @adityaramani Assigned you to review when you have a moment. I pasted some code from an earlier implementation to issue #453 for comparison. |
adityaramani
approved these changes
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Raise the constant from 127 to 255 in
Reference.swiftand update the derivedreferenceTotalLengthMaxaccordingly.Why
Closes #453.
The OCI distribution spec states that the name component of an image reference (registry host + repository path) may be at most 255 bytes. The previous hard-coded limit of 127 characters incorrectly rejected valid references that used long registry hostnames or deep path hierarchies.
The old
referenceTotalLengthMax = 255was also inconsistent: with a 127-char name cap, a 255-char total reference would only allow a very short tag. The new value is derived explicitly asnameTotalLengthMax (255) + separator (1) + tagLengthMax (128) = 384.How
nameTotalLengthMax: 127 → 255tagLengthMax: new constant (128) documenting the maximum tag length already enforced by the tag regex ({0,127}+ leading char = 128 chars).referenceTotalLengthMax: computed from the two constants above (384) rather than hard-coded to 255.Testing
Added three new cases in
ReferenceTests.swift:Checklist