Reject files mixing v1 and v2 registries.conf, even with empty fields#1753
Merged
rhatdan merged 2 commits intocontainers:mainfrom Dec 9, 2022
Merged
Reject files mixing v1 and v2 registries.conf, even with empty fields#1753rhatdan merged 2 commits intocontainers:mainfrom
rhatdan merged 2 commits intocontainers:mainfrom
Conversation
…sConfNonempty We will use it for more tests in the future. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
We already rely on the TOML parser's behavior of setting specified arays to [], but missing arrays to nil, so just use it to be more strict. This can help situations like > [registries.search] > registries = [] > > [registries.insecure] > registries = [] > > [registries.block] > registries = [] > > unqualified-search-registries = ["docker.io"] > > [[registry]] > ... although only indirectly: From the TOML parser's point of view, the unqualified-search-registries field is block.unqualified-search-registries and therefore invisible to us. Conceptually, the same thing could happen with > [arbitrary-unknown] > unqualified-search-registries > > [[registry]] > ... and we wouldn't warn about that. Even so, the config file author specifying even empty fields is suspect and suggests a problem to be resolved. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Collaborator
Author
|
Fixes #1054 . |
Member
|
LGTM |
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.
We already rely on the TOML parser's behavior of setting specified arrays to
[], but missing arrays tonil; so just use it to be more strict.This can help situations like
although only indirectly: From the TOML parser's point of view, the
unqualified-search-registriesfield isblock.unqualified-search-registriesand therefore invisible to us. Conceptually, the same thing could happen withand we wouldn't warn about that.
Even so, the config file author specifying even empty fields is suspect and suggests a problem to be resolved.
Note that this could possibly break current users that generate slightly-nonsensical files.