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
Currently, if you use repo.ResetTargetsDelegations, the targets delegation looks like:
"delegations": {
"keys": {},
"roles": null
}
The null in the roles field, while valid JSON, is not handled properly by other TUF clients. For example, python-tuf will through a deserialization error:
Traceback (most recent call last):
File "/home/asraa/git/python-tuf/tuf/api/serialization/json.py", line 37, in deserialize
metadata_obj = Metadata.from_dict(json_dict)
File "/home/asraa/git/python-tuf/tuf/api/metadata.py", line 198, in from_dict
signed=cast(T, inner_cls.from_dict(metadata.pop("signed"))),
File "/home/asraa/git/python-tuf/tuf/api/metadata.py", line 1960, in from_dict
delegations = Delegations.from_dict(delegations_dict)
File "/home/asraa/git/python-tuf/tuf/api/metadata.py", line 1695, in from_dict
return cls(keys_res, roles_res, succinct_roles_info, delegations_dict)
File "/home/asraa/git/python-tuf/tuf/api/metadata.py", line 1630, in __init__
raise ValueError("One of roles and succinct_roles must be set")
ValueError: One of roles and succinct_roles must be set
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/asraa/git/python-tuf/client-test.py", line 27, in <module>
updater.refresh()
File "/home/asraa/git/python-tuf/tuf/ngclient/updater.py", line 129, in refresh
self._load_targets(Targets.type, Root.type)
File "/home/asraa/git/python-tuf/tuf/ngclient/updater.py", line 395, in _load_targets
delegated_targets = self._trusted_set.update_delegated_targets(
File "/home/asraa/git/python-tuf/tuf/ngclient/_internal/trusted_metadata_set.py", line 417, in update_delegated_targets
new_delegate = Metadata[Targets].from_bytes(data)
File "/home/asraa/git/python-tuf/tuf/api/metadata.py", line 264, in from_bytes
return deserializer.deserialize(data)
File "/home/asraa/git/python-tuf/tuf/api/serialization/json.py", line 40, in deserialize
raise DeserializationError("Failed to deserialize JSON") from e
tuf.api.serialization.DeserializationError: Failed to deserialize JSON
Let's fix this to use an empty array instead? Or simply remove the entire delegations. This fixes the problem:
Currently, if you use
repo.ResetTargetsDelegations
, the targets delegation looks like:The
null
in the roles field, while valid JSON, is not handled properly by other TUF clients. For example, python-tuf will through a deserialization error:Let's fix this to use an empty array instead? Or simply remove the entire delegations. This fixes the problem:
with the
delegations
JSON object removed.cc @ethan-lowman-dd @joshuagl
Detected in sigstore/root-signing#410
The text was updated successfully, but these errors were encountered: