Support spec_version 1.0.x for better interoperability with other TUF implementations#417
Open
llbxg wants to merge 1 commit into
Open
Support spec_version 1.0.x for better interoperability with other TUF implementations#417llbxg wants to merge 1 commit into
spec_version 1.0.x for better interoperability with other TUF implementations#417llbxg wants to merge 1 commit into
Conversation
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.
description
I am evaluating
rust-tufas a client-side library for embedded Linux / CIP1 use cases.As part of that work, I tested a client based on
rust-tufwith other TUF repositories and server-side implementations.I found an interoperability issue. The
rust-tufclient currently acceptsspec_versionvalues such as1.0and1.0.0.But current TUF metadata in the ecosystem often uses
1.0.x.This PR keeps compatibility with the old
1.0value. It also accepts numeric1.0.xvalues such as1.0.31.I kept this change small.
1.0is still accepted for compatibility with existing metadata1.0.xis accepted1.1.0and2.0.0are still rejected1.x.yThe TUF specification leaves this point open. It says that
spec_versionuses SemVer, but adopters can decide what counts as a match 2.Because of that, I am proposing a small interoperability fix here, not a broader policy change.
I also checked a few other TUF projects.
tuf-conformanceincludes metadata withspec_version: "1.0.31"3python-tufaccepts numericX.Y/X.Y.Zand matches on major version 4tuf-jsseems to use almost the same policy 5go-tufwrites1.0.31, and from a quick look at the current source I could not find the same strictspec_versioncheck in the main parse path 6There is still a bigger design question: should
rust-tufaccept1.x.ymore generally, likepython-tufandtuf-js?I think that question should be decided separately.
For this PR, I wanted to focus on the immediate interoperability issue reported in #410.
If maintainers prefer a different direction, I am happy to adjust this PR or split follow-up interoperability changes into separate PRs.
verification
spec_versionvalidation testspec_version: "1.0.31"spec_versionClick to expand
cargo test -p tuf --lib pouf::pouf1::shims::test::spec_version_validation -- --exactcargo test -p tuf --lib metadata::test::deserialize_json_root_accepts_1_0_x_spec_version -- --exactcargo test -q-> all tests passed
REF
1.0.0as valid #386Footnotes
https://cip-project.org/ ↩
https://github.com/theupdateframework/specification/blob/v1.0.31/tuf-spec.md?plain=1#L690 ↩
https://github.com/theupdateframework/tuf-conformance/blob/eeb82bff9ce7e19133d24bc7bd44a7e8908546ed/tuf_conformance/static_data/tuf-on-ci-0.11/metadata/1.root.json#L60 ↩
https://github.com/theupdateframework/python-tuf/blob/9a3c3046d6ffdc9d90ec21ce5237721bcd985652/tuf/api/_payload.py#L137 ↩
https://github.com/theupdateframework/tuf-js/blob/a399ce87d8d908f64d53696a673420193424e0de/packages/models/src/base.ts#L41 ↩
metadata/types.go,metadata/metadata.go,metadata/marshal.go↩