-
Notifications
You must be signed in to change notification settings - Fork 275
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
Add stricter TARGETPATH and PATHPATTERN checks #1018
Comments
I wonder if there's anything more to do here? |
I think the big question is how much input validation should be performed in the Metadata API, which still remains unanswered (#1130) The checks requested in this ticket are currently not performed in the relevant interfaces: TARGETPATH not checked at all python-tuf/tuf/api/metadata.py Line 1503 in 8ac7167
PATHPATTERN only checked to be strings python-tuf/tuf/api/metadata.py Lines 1278 to 1279 in 8ac7167
I lean towards implementing the requested checks, also to be consistent with places where we do check more strictly eg. python-tuf/tuf/api/metadata.py Lines 1498 to 1499 in 8ac7167
cc @MVrachev (head of validation) |
We have implemented validation for quite many attributes of the Metadata classes (see #1140 (comment)). In this particular case:
Together with @jku we had discussions about how we should handle
Again with @jku we had discussions for @lukpueh what do you think about those arguments? |
Thanks for sharing those resources, @MVrachev. Do I understand correctly that they argue that we don't need the check because the client will fail gracefully for any string even if it does not have the recommended format? That would be a fair argument. Although it could also be used against the |
I suppose for TARGETPATH my logic was this:
PATHPATTERN just follows from there. |
Thanks for the follow-up, @jku! I added a note about this workaround to the repository tool feature request ticket for a convenience function that builds TARGETPATHs from local files. I agree that the Metadata API should not provide that feature (workaround) and as a consequence does not have to vet these parameters as strictly. Closing here.. |
Description of issue or feature request:
#1008 removes ambiguity in interfaces that take TARGETPATH and/or PATHPATTERN arguments, by only accepting paths and path patterns that use "/" as directory separator and don't start with "/".
To make the interface even stronger, we should only accept paths and path patterns that completely adhere to the recommended format.
Note that, although the specification only recommends a format, we agreed that an implementation can be more assertive than the spec (see spec#63 and spec#67).
Current behavior:
Expected behavior:
Functions that take TARGETPATH arguments only accept path-relative-scheme-less-URL strings.
Functions that take PATHPATTERN arguments only accept path-relative-scheme-less-URL strings that may include shell-style glob characters. I suggest to align this with whatever the client updater supports.
The text was updated successfully, but these errors were encountered: