-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expected signing entity verification #6359
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
} | ||
} else { | ||
// Unsure if this case is reachable in practice. | ||
throw SigningError.expectedIdentityNotFound(package: identity) |
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'm not sure how we get into this scenario, so this isn't covered by any tests right now.
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.
Is this more of an invalid state error?
@swift-ci please smoke test |
try expectedSigningEntities.forEach { identity, expectedSigningEntity in | ||
if let package = packageGraph.packages.first(where: { $0.identity == identity }) { | ||
if let actualSigningEntity = package.registryMetadata?.signature?.signedBy { | ||
if actualSigningEntity != expectedSigningEntity { |
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.
Should the comparison be more limited?
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 do you have in mind? e.g., must be .recognized
?
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 sure, just posing the question
} | ||
} else { | ||
// Unsure if this case is reachable in practice. | ||
throw SigningError.expectedIdentityNotFound(package: identity) |
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.
Is this more of an invalid state error?
This allows clients to pass in a dictionary with expected signing entities that SwiftPM will check after loading the package graph. This can be used by clients to provide a priori configuration of expected signing by the user or provide a way to verify that information that was previously shown to users matches what was verified during signature verification. Note that since this operates at the workspace level, we're verifying against the data cached during signature verification, not against the actual data. rdar://107162424
1ecbcae
to
2792132
Compare
@swift-ci please smoke test |
@swift-ci smoke test macos |
@swift-ci test windows |
This allows clients to pass in a dictionary with expected signing entities that SwiftPM will check after loading the package graph. This can be used by clients to provide a priori configuration of expected signing by the user or provide a way to verify that information that was previously shown to users matches what was verified during signature verification.
Note that since this operates at the workspace level, we're verifying against the data cached during signature verification, not against the actual data.
rdar://107162424