Add SPKI-based certificate pinning support#883
Add SPKI-based certificate pinning support#883o-nnerb wants to merge 28 commits intoswift-server:mainfrom
Conversation
|
Good morning, @Lukasa. Does this PR make sense for AsyncHTTPClient? I’m currently developing an application and need this feature. I’ve researched the topic and found some use cases on https://github.com/datatheorem/TrustKit. I’ve also made this a draft because I’ll need more time to implement the tests. |
Sources/AsyncHTTPClient/ConnectionPool/HTTPConnectionPool+Factory.swift
Outdated
Show resolved
Hide resolved
Sources/AsyncHTTPClient/ConnectionPool/HTTPConnectionPool+Factory.swift
Outdated
Show resolved
Hide resolved
Sources/AsyncHTTPClient/ConnectionPool/ChannelHandler/SPKIPinningHandler.swift
Outdated
Show resolved
Hide resolved
Sources/AsyncHTTPClient/ConnectionPool/ChannelHandler/SPKIPinningHandler.swift
Outdated
Show resolved
Hide resolved
Sources/AsyncHTTPClient/ConnectionPool/ChannelHandler/SPKIPinningHandler.swift
Outdated
Show resolved
Hide resolved
Sources/AsyncHTTPClient/ConnectionPool/ChannelHandler/SPKIPinningHandler.swift
Outdated
Show resolved
Hide resolved
Sources/AsyncHTTPClient/ConnectionPool/ChannelHandler/SPKIPinningHandler.swift
Show resolved
Hide resolved
Sources/AsyncHTTPClient/ConnectionPool/ChannelHandler/SPKIPinningHandler.swift
Outdated
Show resolved
Hide resolved
|
@Lukasa, any updates on this? |
|
Hi @Lukasa, just checking in on this PR. No rush, but let me know if there's anything else you'd like me to adjust before we move forward. 🙏 |
|
Hi @Lukasa, just checking in again. I noticed there are still 2 workflows awaiting maintainer approval which might be blocking the checks. I need to move forward with this feature in my project, so if there's no traction soon, I'll likely close this PR to keep my workspace clean and maintain it on a fork. Let me know if you think this is still on the roadmap! |
|
@fabianfett, will this PR be acceptable? Is this feature relevant to this package? |
|
@fabianfett @Lukasa, could you please run the CI again? I believe all the updates have been applied. |
|
@fabianfett @Lukasa, please provide any updates. I believe it’s ready for a new review and CI check. 😢 |
|
@fabianfett, could you please explain the linkage error and its relation to this implementation? I’m unable to identify the specific change that would resolve this issue. |
This PR introduces SPKI-based certificate pinning to
AsyncHTTPClient, enabling clients to enforce explicit trust in server certificates beyond standard PKI validation. This provides protection against compromised Certificate Authorities and MITM attacks.🔑 Key features
.strict(production): blocks connections on pin mismatch.audit(staging): allows connections but logs warnings for observabilitySPKIHash(algorithm:*:)🛡️ Security by design
< 2 pinsare configured in.strictmode (caller-managed redundancy)HTTPClientError.invalidCertificatePinningon mismatch🧪 Usage example
📚 References