Skip to content

Rewrite PackageCollectionsSigning using swift-certificates #6468

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

Merged
merged 4 commits into from
May 4, 2023

Conversation

yim-lee
Copy link
Contributor

@yim-lee yim-lee commented Apr 21, 2023

Motivation:
PackageCollectionsSigning was written before swift-certificates and swift-asn1 were available. The implementation relied on BoringSSL C library via CCryptoBoringSSL, which is not meant to be used outside of swift-crypto because it introduces Swift-breaking changes often (as SwiftPM had experienced with version 2.4.1).

Modifications:

  • Rewrite PackageCollectionsSigning using swift-certificates and swift-asn1 so we can remove CCryptoBoringSSL dependency.
  • PackageCollectionsSigningLibC, which contains SwiftPM's implementation of OCSP, is no longer needed and removed in this PR.

@yim-lee yim-lee marked this pull request as draft April 21, 2023 21:45
case appleSwiftPackageCollection(subjectUserID: String? = nil, subjectOrganizationalUnit: String? = nil)

@available(*, deprecated, message: "use `appleSwiftPackageCollection` instead")
case appleDistribution(subjectUserID: String? = nil, subjectOrganizationalUnit: String? = nil)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated

}

Task {
var trustStore = CertificateStores.defaultTrustRoots
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A major change in the new implementation is that we no longer use the system trust store (we used to on Darwin platforms through the Security framework) and SwiftPM will its own default trust store instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both this and PackageSigning require the same resources. Would it make sense to have a shared resource-only module?

@yim-lee yim-lee force-pushed the collections-signing branch from f3b0bdc to 6a2c60d Compare April 25, 2023 21:50
@yim-lee
Copy link
Contributor Author

yim-lee commented Apr 25, 2023

@swift-ci please test Windows platform

/** Package collections signing C lib */
name: "PackageCollectionsSigningLibc",
dependencies: [
.product(name: "Crypto", package: "swift-crypto"), // for CCryptoBoringSSL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done still need the dependency on swift-crypto?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we still need it for keys and signing.

@yim-lee yim-lee force-pushed the collections-signing branch from 7362c2a to 9702079 Compare May 2, 2023 00:47
@yim-lee yim-lee self-assigned this May 2, 2023
@yim-lee yim-lee marked this pull request as ready for review May 2, 2023 18:35
@yim-lee yim-lee force-pushed the collections-signing branch from 9702079 to b029026 Compare May 2, 2023 18:43
@yim-lee
Copy link
Contributor Author

yim-lee commented May 3, 2023

I have just discovered an issue with this code and will need to look into it. Putting this back in Draft for now so we don't merge it by accident.

Figured it out. Moving this out of Draft.

@yim-lee yim-lee marked this pull request as draft May 3, 2023 20:29
yim-lee added 4 commits May 3, 2023 16:05
Motivation:
`PackageCollectionsSigning` was written before `swift-certificates` and `swift-asn1` were available. The implementation relied on BoringSSL C library via `CCryptoBoringSSL`, which is not meant to be used outside of `swift-crypto` because it introduces Swift-breaking changes often (as SwiftPM had experienced with version `2.4.1`).

Modifications:
- Rewrite `PackageCollectionsSigning` using `swift-certificates` and `swift-asn1` so we can remove `CCryptoBoringSSL` dependency.
- `PackageCollectionsSigningLibC`, which contains SwiftPM's implementation of OCSP, is no longer needed and removed in this PR.
@yim-lee yim-lee force-pushed the collections-signing branch from b029026 to 63ca5f0 Compare May 3, 2023 23:07
@yim-lee yim-lee marked this pull request as ready for review May 3, 2023 23:07
@yim-lee
Copy link
Contributor Author

yim-lee commented May 3, 2023

@swift-ci please smoke test

@yim-lee
Copy link
Contributor Author

yim-lee commented May 3, 2023

@swift-ci please test Windows platform

@yim-lee yim-lee merged commit ef422c1 into swiftlang:main May 4, 2023
@yim-lee yim-lee deleted the collections-signing branch May 4, 2023 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants