Commit fffa895
committed
spec: Clarify Referrers Tag Schema vs. alternative algorithms
From the referenced OCI spec:
digest ::= algorithm ":" encoded
algorithm ::= algorithm-component (algorithm-separator algorithm-component)*
algorithm-component ::= [a-z0-9]+
algorithm-separator ::= [+._-]
encoded ::= [a-zA-Z0-9=_-]+
But from the distribution-spec:
Throughout this document, `<reference>` as a tag MUST be at most 128 characters in length and MUST match the following regular expression:
`[a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}`
Happily, the fist character of algorithm must match
algorithm-component, and its [a-z0-9] a subset of the tag regexp's
opening [a-zA-Z0-9_]. And the colon separating algorithm from encoded
was already addressed in the outgoing text. But the digest definition
also allows + in the algorithm-separator and = in the encoded portion,
which the tag regexp does not allow, so with the incoming wording I'm
requiring that to be replaced by a - as well, so clients make
consistent choices when deciding how to handle that character while
forming distribution-spec referrer tags.
And I'm requiring clients to truncate the tag to 128 characters, again
so clients make consistent choices when trying to compress from the
strings the digest specification allows to the strings tags allow.
There is no requirement in the distribution spec as far as I can tell
that registries support tags up to 128 characters, but given that the
spec explicitly requires clients to not exceed that length, it seems
likely that registries will allow tags of that length, and not require
further truncation.
I'm requiring clients to truncate the encoded section to 64
characters, in addition to the overall tag truncation at 128
characters, because that's one possible reading of the outgoing "limit
of 64 characters" parenthetical, and at least one client had
implemented it that way [1].
And clients are obviously free to create whatever tags they like that
the registry will accept. The MUST I'm adding does not forbid that.
It only clarifies the single distribution-spec Referrers Tag
associated with a given digest, because if there could be multiple
Referrers Tag for each digest, all distribution-spec
referrer-retrieving clients would have to iterate over that whole set
of possibilities, in case some distribution-spec referrer-pushing
client happened to use one of that digest's other Referrers Tag
formats.
[1]: https://github.com/regclient/regclient/blob/dbb1434fd4b8b650983e8c51933789712e05eeaa/types/referrer/referrer.go#L157
Signed-off-by: W. Trevor King <[email protected]>1 parent 7872490 commit fffa895
1 file changed
+8
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
721 | 721 | | |
722 | 722 | | |
723 | 723 | | |
724 | | - | |
725 | | - | |
726 | | - | |
| 724 | + | |
| 725 | + | |
727 | 726 | | |
728 | | - | |
729 | | - | |
| 727 | + | |
730 | 728 | | |
731 | | - | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
732 | 734 | | |
733 | 735 | | |
734 | 736 | | |
| |||
0 commit comments