mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Metadata API: Add simple threshold validation
Probably there could be future API calls that modify "threshold" to a new value, but the problem is we don't have a clear idea if they would exist and what exactly they will do. That's why it makes sense to validate against the potential problems we can imagine - in this case, is passing a threshold below 1. Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
This commit is contained in:
parent
2a5bfb9cac
commit
6c5d970799
1 changed files with 2 additions and 0 deletions
|
|
@ -506,6 +506,8 @@ def __init__(
|
|||
f"keyids should be a list of unique strings,"
|
||||
f" instead got {keyids}"
|
||||
)
|
||||
if threshold < 1:
|
||||
raise ValueError("threshold should be at least 1!")
|
||||
self.keyids = keyids_set
|
||||
self.threshold = threshold
|
||||
self.unrecognized_fields: Mapping[str, Any] = unrecognized_fields or {}
|
||||
|
|
|
|||
Loading…
Reference in a new issue