theupdateframework / theupdateframework/python-tuf

Try constructor improvements for Delegations/ delegated roles

Open
#2,071 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.7k
Forks
304
Avg merge
1d 2h
Merged PRs (30d)
17

Description

Currently creating e.g. succinct delegations looks like this

BIT_LENGTH = int(math.log2(NUMBER_OF_BINS))
succinct_roles = SuccinctRoles(
    keyids=[bins_key.keyid],
    threshold=THRESHOLD,
    bit_length=BIT_LENGTH,
    name_prefix=NAME_PREFIX,
)
delegations_keys_info: Dict[str, Key] = {}
delegations_keys_info[bins_key.keyid] = bins_key

targets.signed.delegations = Delegations(
    delegations_keys_info, roles=None, succinct_roles=succinct_roles
)

Looks bad, i'm sure we could get that to something a bit like:

targets.signed.delegations = Delegations(SuccinctRoles.new(NUMBER_OF_BINS, NAME_PREFIX))
targets.add_key(bins_key)

Or alternatively

targets.signed.delegations = Delegations.new_succint(NUMBER_OF_BINS, NAME_PREFIX)
targets.add_key(bins_key)

What makes sense probably depends on what the other delegation types (most importantly paths delegation) will look like...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the Delegations and SuccinctRoles constructors, then compare them with the other delegation types, especially path delegations. The design is complete when the project has an agreed simpler construction flow for succinct delegations and key registration that fits the other delegation APIs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
security
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.