Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use spec-compliant persisted target filenames #411

Merged
merged 1 commit into from
Apr 5, 2023

Conversation

loosebazooka
Copy link
Member

@asraa recently informed me that we shouldn't be persisting down to disk (or wherever) with the sha prefixed filename.

context: https://theupdateframework.github.io/specification/latest/index.html#fetch-target

Signed-off-by: Appu Goundan <appu@google.com>
@loosebazooka loosebazooka added the safe to test conformance testing label label Apr 4, 2023
Copy link

@asraa asraa left a comment

Choose a reason for hiding this comment

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

🥳

@@ -420,7 +420,10 @@ void downloadTargets(Targets targets)
throw new FileNotFoundException(targetName, fetcher.getSource());
}
verifyHashes(entry.getKey(), targetBytes, targetData.getHashes());
localStore.storeTargetFile(versionedTargetName, targetBytes);

// when persisting targets use the targetname without sha512 prefix
Copy link
Collaborator

Choose a reason for hiding this comment

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

The link you mention suggests checksum-prefixed names for consistent snapshots scheme. Why we should skip checksums here?

Copy link

Choose a reason for hiding this comment

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

This is the relevant line of the link:

In either case, the client MUST write the file to non-volatile storage as FILENAME.EXT.

The code already does fetch by the checksummed prefixed name (versionedTargetName), but we write without the prefix.

@loosebazooka loosebazooka merged commit e1b8824 into main Apr 5, 2023
@loosebazooka loosebazooka deleted the target-persist-name branch April 5, 2023 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test conformance testing label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants