-
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
Reduce errors from manifest signature validation #6325
Conversation
@swift-ci please smoke test |
@@ -201,6 +204,88 @@ struct SignatureValidation { | |||
} | |||
} | |||
|
|||
private func validateSourceArchiveSignature( |
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 is the same as the original validateSignature
.
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.
What's the reason for this function itself not being async
? Only trying to understand whether we're trying to avoid async
functions completely for now or is there some boundary along within which we should keep functions callback-based?
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.
RegistryClient
(the caller of this) uses callback so async
has to stop somewhere (for now at least).
In case of an error during manifest signature validation, I would expect archive validation to not even happen because we wouldn't know which archive to even download. Am I missing something? |
9169ece
to
c7975a0
Compare
@swift-ci please smoke test |
@swift-ci please test Windows platform |
@@ -2259,14 +2259,29 @@ extension RegistryReleaseMetadata { | |||
private struct RegistryClientSignatureValidationDelegate: SignatureValidation.Delegate { | |||
let underlying: RegistryClient.Delegate? | |||
|
|||
private let onUnsignedResponseCache = ThreadSafeKeyValueStore<ResponseCacheKey, Bool>() | |||
private let onUntrustedResponseCache = ThreadSafeKeyValueStore<ResponseCacheKey, Bool>() |
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.
Added caching to avoid prompting repeatedly
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.
👍
case .success(let signingEntity): | ||
// Always do signing entity TOFU check at the end, | ||
// whether the manifest is signed or not. | ||
self.signingEntityTOFU.validate( |
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.
TOFU
@@ -304,48 +412,38 @@ struct SignatureValidation { | |||
version: version | |||
) | |||
|
|||
// Prompt if configured, otherwise just continue (this differs | |||
// from source archive to minimize duplicate loggings). |
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.
👀
Motivation: Manifest signature validation works similarly as source archive signature validation, meaning user could see duplicate errors (e.g., source archive not signed). Modifications: - Change most error throwing to logging diagnostics for manifest signature validation - Continue to prompt if that's what user has configured for unsigned packages or untrusted signers; cache responses in memory to prevent repeatedly prompting for manifest and source archive downloads for the same package version. - Wire up publisher TOFU for manifest signing - Adjust tests
c7975a0
to
d0accdc
Compare
@swift-ci please smoke test |
@swift-ci please test Windows platform |
windows CI has been unstable all day. okay to merge without. |
@swift-ci please test Windows platform |
Motivation: Manifest signature validation works similarly as source archive signature validation, meaning user could see duplicate errors (e.g., source archive not signed). Modifications: - Change most error throwing to logging diagnostics for manifest signature validation - Continue to prompt if that's what user has configured for unsigned packages or untrusted signers; cache responses in memory to prevent repeatedly prompting for manifest and source archive downloads for the same package version. - Wire up publisher TOFU for manifest signing - Adjust tests
Motivation: Manifest signature validation works similarly as source archive signature validation, meaning user could see duplicate errors (e.g., source archive not signed). Modifications: - Change most error throwing to logging diagnostics for manifest signature validation - Continue to prompt if that's what user has configured for unsigned packages or untrusted signers; cache responses in memory to prevent repeatedly prompting for manifest and source archive downloads for the same package version. - Wire up publisher TOFU for manifest signing - Adjust tests
Motivation:
Manifest signature validation works similarly as source archive signature validation, meaning user could see duplicate errors (e.g., source archive not signed).
Modifications: