You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ngclient updates top-level targets during refresh(). Then on get_one_valid_targetinfo() the top-level targets is updated again:
this is not dangerous and does not break any TrustedMetadataSet constraints
nothing is downloaded but the local metadata file is re-read and re-parsed
Mostly this is just annoying in the logs because it looks like a bug, with two updates usually one right after the other.
This could be fixed as a special case for top-level targets in the delegation loop but I think a similar issue comes up if other targets are already loaded, but then are needed in _preorder_depth_first_walk(). Maybe _load_targets() should check if a targets metadata is loaded and avoid re-loading in that case (if a targets is loaded it should be completely final and valid)?
The text was updated successfully, but these errors were encountered:
Maybe _load_targets() should check if a targets metadata is loaded and avoid re-loading in that case (if a targets is loaded it should be completely final and valid)?
The only scenario where we might be skipping a newer delegated role metadata file is the unlikely case where the file is updated between two get_one_valid_targetinfo calls but this should be a very short period of time:
updater=Updater()
updater.refresh()
updater.get_one_valid_targetinfo("file1") # "some_role" is loaded and checked for file1
...
updater.refresh() # newer snapshot is downloaded with newer version of "some_role"updater.get_one_valid_targetinfo("file2") # "some_role" is not reloaded and the older version is used to check for file2
But is this the correct sequence? I don't think we should be calling refresh() before each get_one_valid_targetinfo?
But is this the correct sequence? I don't think we should be calling refresh() before each get_one_valid_targetinfo?
No we should not. It's also currently impossible: calling refresh() twice is an error as it tries to break TrustedMetadataSet rules (of course we could change how refresh works but in practice it would mean calling refresh() again is the same thing as creating a new Updater and then calling refresh() -- the only optimization would be that we don't have to load the local root from disk so not really worth it)
ngclient updates top-level targets during
refresh()
. Then onget_one_valid_targetinfo()
the top-level targets is updated again:Mostly this is just annoying in the logs because it looks like a bug, with two updates usually one right after the other.
This could be fixed as a special case for top-level targets in the delegation loop but I think a similar issue comes up if other targets are already loaded, but then are needed in
_preorder_depth_first_walk()
. Maybe_load_targets()
should check if a targets metadata is loaded and avoid re-loading in that case (if a targets is loaded it should be completely final and valid)?The text was updated successfully, but these errors were encountered: