-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Package fingerprint storage #3879
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
Conversation
@swift-ci please smoke test |
Tests/PackageFingerprintTests/FilePackageFingerprintStorageTests.swift
Outdated
Show resolved
Hide resolved
|
||
init(customFileSystem: FileSystem? = nil, customDirectory: AbsolutePath? = nil) { | ||
self.fileSystem = customFileSystem ?? localFileSystem | ||
self.directory = customDirectory ?? self.fileSystem.dotSwiftPM.appending(component: "fingerprints") |
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.
the default location can go into Workspace.Location / DefaultLocation which handles similar set ups
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.
Making both required so no need to have defaults here.
Motivation: Provide trust-on-first-use (TOFU) security model for package dependencies. SwiftPM will record locally the "fingerprint" of a package version when it is first downloaded and ensure the fingerprint remain the same in subsequent downloads. For package downloaded from registry, the fingerprint is the source archive checksum. For source control, it is the git revision. This PR only adds storage APIs for writing and reading package fingerprints and an implementation that uses local file system. The integration of fingerprint storage into the download workflow(s), i.e. TOFU implementation, will come in a separate PR. Modifications: - Add `PackageFingerprint` module. - Add `PackageFingerprintStorage` protocol that defines APIs for reading and writing fingerprints. - Add `FilePackageFingerprintStorage` which is an implementation based on file system.
cec0397
to
dc98e7f
Compare
@swift-ci please smoke test |
This is a continuation of swiftlang#3879. Wire up fingerprint storage such that it is used for integrity checks of package downloads. Fingerprint must match previously recorded value (if any) or else it would result in an error.
This is a continuation of swiftlang#3879. Wire up fingerprint storage such that it is used for integrity checks of package downloads. Fingerprint must match previously recorded value (if any) or else it would result in an error.
Wire up fingerprint storage such that it is used for integrity checks of package downloads. Fingerprint must match previously recorded value (if any) or else it would result in an error.
Wire up fingerprint storage such that it is used for integrity checks of package downloads. Fingerprint must match previously recorded value (if any) or else it would result in an error.
Wire up fingerprint storage such that it is used for integrity checks of package downloads. Fingerprint must match previously recorded value (if any) or else it would result in an error.
Wire up fingerprint storage such that it is used for integrity checks of package downloads. Fingerprint must match previously recorded value (if any) or else it would result in an error.
Wire up fingerprint storage such that it is used for integrity checks of package downloads. Fingerprint must match previously recorded value (if any) or else it would result in an error.
Wire up fingerprint storage such that it is used for integrity checks of package downloads. Fingerprint must match previously recorded value (if any) or else it would result in an error.
Sorry @compnerd, is there anything I need to do to help fix the Windows builds? |
Thanks @yim-lee. I'll rest to see if I can put up a change later (tomorrow likely). Is there any new target other than PackageFingerprint or any new dependencies? |
The problem is due to packaging, so there needs to be an associated change in apple/swift-installer-scripts to package up the additional DLL. Assuming that it is just SystemPackage and OrderedCollections that are used, I think that its just the single missing dll. |
This adds the new Swift Package Manager content from swiftlang/swift-package-manager#3879 to the installation manifest.
swiftlang/swift-installer-scripts#69 should be what is needed. |
Motivation:
Provide trust-on-first-use (TOFU) security model for package dependencies. SwiftPM will record locally the "fingerprint" of a package version when it is first downloaded and ensure the fingerprint remain the same in subsequent downloads.
For package downloaded from registry, the fingerprint is the source archive checksum. For source control, it is the git revision.
This PR only adds storage APIs for writing and reading package fingerprints and an implementation that uses local file system. The integration of fingerprint storage into the download workflow(s), i.e. TOFU implementation, will come in a separate PR.
Modifications:
PackageFingerprint
module.PackageFingerprintStorage
protocol that defines APIs for reading and writing fingerprints.FilePackageFingerprintStorage
which is an implementation based on file system.