Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate spec_version during initialization
According to point 2 in the semver specification: "A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative integers...". See: https://semver.org/#spec-item-2 Also, even though version strings like "2.0.0-rc.2" or "1.0.0-beta" are valid strings in semantic versioning format, in TUF we never needed to add letters for our specification number. That's why I validate that: spec_version is a . separated string and when split it has a length of 3 and that each of the three elements is a number. The modules under the tuf/api folder in TUF are an alternative TUF implementation. That's why they should use their own constant for SPECIFICATION_VERSION in tuf/metadata/api. This time, I used a list for the SPECIFICATION_VERSION constant in order to retrieve major and minor versions easier. I use the SPECIFICATION_VERSION to check that the given spec_version is supported against the tuf code spec version. Signed-off-by: Martin Vrachev <[email protected]>
- Loading branch information