-
Notifications
You must be signed in to change notification settings - Fork 278
api/metadata input validation: hashes #1441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
'Hashes' is a dictionary of the form:
Both keys and values could benefit a validation.
Another possible option is to allow any values which will raise errors later during meta/target files hash verification step. What must be strictly disallowed is an empty dictionary which may lead to skipping the mandatory hash verification check. |
algorithms (dict keys) options:
hash (dict values) options:
both of these checks mostly matter for deserialization: for adding/modifying new hashes through API we should at some point provide functions that generate the hashes when given the data: E.g. |
We wrote mostly the same comment :)
Oh good catch, the spec does specify this: dictionary that specifies one or more hashes |
For For |
Yeah that would be the way -- we absolutely do not want to guess in TUF. The only possible worry I have is the same future situation that I tried to talk about in the key case, where in a metadata file
The scenario seems unlikely but I think we should keep this sort of thing in mind when validating sets that may be extended over time (hash and signing algorithms at least). |
I wonder what the implications here are for prioritized delegations. If an attacker was somehow able to remove a supported algorithm, could they use that to convince a user to install a less-optimal package? |
My comment on the key-discussion appliess 100% here as well: TL;DR: Metadata validity and our implementations ability to verify hashes are two different things: I think we should not consider metadata invalid just because it contains a hash algorithm we haven't heard of. |
Considering your comments, my suggestion in #1451:
Checking the validity of hash algorithms is not part of the metadata input validation and is done by |
Description of issue or feature request:
Implement input validation for
TargetFile
andMetaFile
hashes
attribute.Current behavior:
The new api/metadata code does not perform any input validation on
hashes
.formats.py
has a definedHASHDICT_SCHEMA
that is not used in the new code.Expected behavior:
Define allowed values for hashes.
Implement the verification in
metadata.py
The text was updated successfully, but these errors were encountered: