-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Package manifest checksum TOFU #6322
Conversation
@swift-ci please smoke test |
{ result in queue.async { closure(result) } } | ||
} | ||
} | ||
|
||
private enum StorageModel { | ||
struct Container: Codable { | ||
let versionFingerprints: [String: [String: StoredFingerprint]] | ||
// version -> fingerprint kind -> fingerprint content type | ||
let versionFingerprints: [String: [String: [String: StoredFingerprint.V2]]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note the storage model changes
) { | ||
let contentType = Fingerprint.ContentType.manifest(toolsVersion) | ||
|
||
self.readFromStorage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike source archives, registry doesn't provide expected checksum for manifests, so here we do true TOFU I suppose, and that is if checksum not found in storage we save it (whereas for source archive we have registry as an other source).
@@ -67,7 +68,8 @@ public final class RegistryClient: Cancellable { | |||
authorizationProvider: AuthorizationProvider? = .none, | |||
customHTTPClient: LegacyHTTPClient? = .none, | |||
customArchiverProvider: ((FileSystem) -> Archiver)? = .none, | |||
delegate: Delegate? | |||
delegate: Delegate?, | |||
checksumAlgorithm: HashAlgorithm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This moves passing of checksumAlgorithm
from downloadSourceArchive
to "global"
Motivation: SwiftPM should do checksum TOFU for package manifests. Modifications: - Modify fingerprint storage structure to store fingerprint by content type - Modfiy fingerprint storage API to allow retrieving fingerprints by content type - Add API to `ChecksumTOFU` for manifests - Wire up manifest TOFU in `RegistryClient`
@swift-ci please smoke test |
@swift-ci please test Windows platform |
* Package manifest checksum TOFU Motivation: SwiftPM should do checksum TOFU for package manifests. Modifications: - Modify fingerprint storage structure to store fingerprint by content type - Modfiy fingerprint storage API to allow retrieving fingerprints by content type - Add API to `ChecksumTOFU` for manifests - Wire up manifest TOFU in `RegistryClient` * address review feedback
* Package manifest checksum TOFU Motivation: SwiftPM should do checksum TOFU for package manifests. Modifications: - Modify fingerprint storage structure to store fingerprint by content type - Modfiy fingerprint storage API to allow retrieving fingerprints by content type - Add API to `ChecksumTOFU` for manifests - Wire up manifest TOFU in `RegistryClient` * address review feedback
Motivation:
Currently fingerprints are for source archive (checksum from registry) and source repo (git hash from SCM) only. Additional content types need to be supported if SwiftPM were to do TOFU for manifest files too.
Modifications: