Skip to content

Move known roles in TUF#826

Merged
loosebazooka merged 1 commit intomainfrom
change-roles-a-bit
Oct 9, 2024
Merged

Move known roles in TUF#826
loosebazooka merged 1 commit intomainfrom
change-roles-a-bit

Conversation

@loosebazooka
Copy link
Member

Roles were a bit too tightly coupled to the root roles, change this around a tiny bit so we can add delegations support

Roles were a bit too tightly coupled to the root roles, change
this around a tiny bit so we can add delegations support

Signed-off-by: Appu Goundan <appu@google.com>
@loosebazooka loosebazooka requested a review from patflynn October 7, 2024 19:20
<T extends SignedTufMeta> Optional<MetaFetchResult<T>> getMeta(Role.Name name, Class<T> roleType)
throws IOException, FileExceedsMaxLengthException;
<T extends SignedTufMeta<? extends TufMeta>> Optional<MetaFetchResult<T>> getMeta(
String name, Class<T> roleType) throws IOException, FileExceedsMaxLengthException;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably obvious, but I don't quite see why we're relaxing from an enum to a string here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it because deserializing an unknown enum value would fail while we might want to skipping unknown roles instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cause you can grab a meta of a delegated target which names are not predefined?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I see. Should we rename the field to be more descriptive since it's just string? I don't remember anymore what it represents. roleName? targetName?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering: does it mean we must never use enum when deserializing input?
Should we replace enum HashAlgorithm with string as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we were ever using the enum at parsing time. It looked like we were using the enum as a naming constraint within the code.

The description for Roles is here: https://theupdateframework.io/metadata/

But functionally, it's an object in an entity that is used to sign metadata.

So root contains roles for root, snapshot, timestamp and targets (the RootRole in this PR)
Target can contain roles for delegations (more targets) and these delegations can contain more roles for more delegations (creating some sort of tree).

@loosebazooka loosebazooka merged commit 8628fc0 into main Oct 9, 2024
@loosebazooka loosebazooka deleted the change-roles-a-bit branch October 9, 2024 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments