-
Notifications
You must be signed in to change notification settings - Fork 278
client/updater design: let user download targets? #1142
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
See also #1135 for more details on mirror configuration (which relates to resolving download URLs part) |
I had a look on the current implementation and I would vote for implementing minimal changes in the current Updater code trying to achieve "let user download targets" sooner and then transfer this to the client refactor. I have some questions and comments for @jku but I'd appreciate general comments related to the client API:
I don't see a reason why we cannot expose a
I can speculate what do you mean @jku but can you be more specific :) Do you mean adding
Currently "updated_targets" looks for targets in a path constructed by filepath and destination_directory. Do you think this logic has to be handled by user too? Maybe an example form the pip local cache that don't match tuf's expectations? |
So I think I was wrong and tuf can handle the cache -- and probably needs to (pip should just disable http caching for these downloads).
So the issue about "resolving URLs" is just that there are multiple potential URLs for a target name One potential solution might be to keep the API as is, but add an optional download handler function argument to |
I start liking the idea of passing a download handler, or even not passing it as a parameter to the download function but adding it as a config on updater init. In TUF the download function signature is:
I guess the requirement for a client would be to pass a download handler that can ensure the downloaded file size? |
Protecting against endless data attacks require us to ensure we are only downloading up to a metadata defined number of bytes. It's easier for the framework to make assertions about that if the framework is controlling downloads. If the handler implements a pre-defined interface, we can offload that responsibility to the client integrating the framework for targets downloads. |
As long as we use 3rd-party code to download, we can never guarantee what it actually does. |
This is now possible with #1250! |
This is a future wishlist item for client API (#1135), based on working on pip integration.
Current issues with TUF from pip point of view:
Some of these could be fixed by adding more complexity to TUF... but potentially the correct fix is to separate downloading from the other TUF functionality and let the clients do that themselves.
High level functionality list of the client currently looks like this:
client.updater.Updater.refresh()
)client.updater.Updater.get_one_valid_targetinfo()
)mirrors.get_list_of_mirrors()
, happens during all metadata and target downloads)client.updater.Updater.updated_targets()
)client.updater.Updater.download_target()
)client.updater.Updater.download_target()
)Maybe we can optionally let user handle "downloading target" and expose "verifying target" step in a more usable way to the user. This means that "resolving download URLs" must be better exposed to user. Also "local cache check" need re-design: if user downloads files, they also control caching so we can't expect tuf cache directory structure to exist.
The text was updated successfully, but these errors were encountered: