-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Signed packages handling in RegistryClient #6184
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
Closed
Closed
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
cf62890
Update registry config to match proposal
yim-lee 81ee879
Setup CMake build for PackageSigning. Add dependency to PackageRegistry.
yim-lee 96c1f49
API tweaks
yim-lee b23260b
Add signature model to package version metadata
yim-lee 48d089f
update cmake build
yim-lee 4551303
Wire up PackageSigningEntityStorage
yim-lee f90ede4
Rename tofu.check to tofu.validate
yim-lee fa06303
Use registry identity in configuration
yim-lee c41b899
Implement signature validation and signing entity TOFU flow. Need tests
yim-lee e1ae8e3
SigningEntity TOFU requires type
yim-lee 2e37845
Add PackageSigningEntityTOFUTests
yim-lee 6619576
Work around 'Task' not found error in CI
yim-lee 992971c
Add SignatureValidationTests
yim-lee 593f79b
Fix CI
yim-lee 8426a0a
Add fatalError for TODOs so we don't forget
yim-lee d6248cf
Lowercase diagnostics
yim-lee 6eca9db
Fix tests
yim-lee d67f64e
Add swift-crypto back to bootstrap
yim-lee 3e76c40
Fix Windows build
yim-lee 8009de9
Make 'import Crypto' implementation only
yim-lee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// | ||
// This source file is part of the Swift open source project | ||
// | ||
// Copyright (c) 2014-2022 Apple Inc. and the Swift project authors | ||
// Copyright (c) 2014-2023 Apple Inc. and the Swift project authors | ||
// Licensed under Apache License v2.0 with Runtime Library Exception | ||
// | ||
// See http://swift.org/LICENSE.txt for license information | ||
|
@@ -14,8 +14,6 @@ import ArgumentParser | |
|
||
import struct Foundation.URL | ||
|
||
import enum PackageFingerprint.FingerprintCheckingMode | ||
|
||
import enum PackageModel.BuildConfiguration | ||
import struct PackageModel.BuildFlags | ||
import struct PackageModel.EnabledSanitizers | ||
|
@@ -31,6 +29,8 @@ import struct TSCBasic.StringError | |
import struct TSCUtility.Triple | ||
import struct TSCUtility.Version | ||
|
||
import struct Workspace.WorkspaceConfiguration | ||
|
||
public struct GlobalOptions: ParsableArguments { | ||
public init() {} | ||
|
||
|
@@ -217,7 +217,10 @@ public struct SecurityOptions: ParsableArguments { | |
#endif | ||
|
||
@Option(name: .customLong("resolver-fingerprint-checking")) | ||
public var fingerprintCheckingMode: FingerprintCheckingMode = .strict | ||
public var fingerprintCheckingMode: WorkspaceConfiguration.CheckingMode = .strict | ||
|
||
@Option(name: .customLong("resolver-signing-entity-checking")) | ||
public var signingEntityCheckingMode: WorkspaceConfiguration.CheckingMode = .warn | ||
} | ||
|
||
public struct ResolverOptions: ParsableArguments { | ||
|
@@ -473,7 +476,7 @@ extension AbsolutePath: ExpressibleByArgument { | |
} | ||
} | ||
|
||
extension FingerprintCheckingMode: ExpressibleByArgument { | ||
extension WorkspaceConfiguration.CheckingMode: ExpressibleByArgument { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Define a wrapper enum in |
||
public init?(argument: String) { | ||
self.init(rawValue: argument) | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not entirely sure about the naming here. I think it could be reasonable to think of the signing identity check as a form of "fingerprint" and therefore assuming it applies to both. I'd rather differentiate the options on the type of dependency and deprecate the old flag.
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.
These are two different types of checks though--we do fingerprint check for SCM and registry dependency, while signing entity check happens for registry dependency only--and I think we should keep the two options separate, at least initially, because the fingerprint check has been around for some time and is mature enough, while with signing entity check I am more comfortable setting the default level to
warn
because it's new and there might be bugs.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.
Didn't realize there was a fingerprint check for registry dependencies as well, is that a checksum of the archive?
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.
Yep. We implemented fingerprint for both SCM and registry packages.
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.
Does that mean we are grouping two fundamentally different types of fingerprints under one option and is that a potential issue? Registry ones are truly immutable (assuming you can't publish a different archive for an existing version) while SCM ones shouldn't typically change but are technically mutable.
Let's presume someone is regularly changing their SCM tags after the fact for some reason and decides to change the fingerprint checking policy because of that, as it stands that would affect registry dependencies as well even though it may not be intended?
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.
Yes, though really, neither of the types should be changing regularly.
I would argue that if a user thinks it's ok to warn instead of error for the uncommon case of regularly changing git hash, then changing checksum is not worse? Checksums are supposed to be immutable, but it depends on registry implementation and thus not guaranteed.
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.
I think it's worse in the sense that they accepted an uncommon case and that implicitly opted them into also accepting a somewhat unrelated case that is likely an actual problem in most scenarios. It's probably fine, though.