-
Notifications
You must be signed in to change notification settings - Fork 21
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
TLS Runtime Issues for GitHub Artifacts built on Windows #126
Comments
So apparently this is |
I'd like to second what |
## 🎟️ Tracking https://bitwarden.atlassian.net/browse/SM-1407 ## 📔 Objective We are having TLS runtime issues for GitHub artifacts built on Windows when using `rustls-platform-verifier`. There is a repository with a simplified example showcasing this bug here: https://github.com/Thomas-Avery/test-rustls-platform-verifier The goal of this PR is to use a work-around on Windows until the bug is fixed. A GitHub issue for this has been created: rustls/rustls-platform-verifier#126 ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes
@ctz @complexspaces I've captured two requests with Wireshark (specifically, the Wireshark build for Windows ARM). One is a successful request with cURL (the cURL on Windows PowerShell), and the other is the failed request sent with the simplified example artifact here. Within the Wireshark file: The packets for the successful request are row #'s: ~22 - 44 Both requests are GET requests to: https://httpbin.org/ In case there is sensitive info within the file, I've uploaded the Wireshark file here: https://send.bitwarden.com/#MyCGYTnaekmYl7HUAQ4OhQ/Ah16xdCywkQdMkVuxW1fQg This was run on Windows 11 Pro on ARM.
|
Thanks, that looks pretty normal to me (real certificate from a real CA, in CT). Looking more closely at the involved code I think we might be missing zero termination on the |
I'm not immediately sure if that's it. The
I can run your test on an ARM64 Windows 11 VM later today and see if that makes a difference. If it doesn't I'll extract the certificates from the capture you provided and see if I can narrow it down by providing the exact chain 👍 |
My parsing of |
I spent a while looking at this tonight and I manged to reproduce it. This was caused UB from a missing NULL terminator like @ctz suspected, but in a fun non-obvious way. With a fresh look it makes sense: how would Windows know where the string ends? I was interested in the actual cause though, so I dug further. The let usage = CERT_USAGE_MATCH {
dwType: USAGE_MATCH_TYPE_AND,
Usage: CTL_USAGE {
cUsageIdentifier: ALLOWED_EKUS.len() as u32,
rgpszUsageIdentifier: ALLOWED_EKUS.as_ptr() as *mut LPSTR,
},
}; The first problem, but that actually wasn't breaking things, was the way the string pointer was getting passed in. The second problem was more interesting. To finally reproduce the error, I actually had to set I opened up both the binary from CI and my local build in Binary Ninja to look at the callsite for differences. Right away something jumped out. Here's what a correct initialization of our Now the binary compiled by GitHub actions: You can see that its getting a Running the bad binary with syscall tracing confirms the hypothesis, where you can see Windows is receiving an invalid eku: As a result of that invalid EKU, the valid one in the certificate isn't in the allow-list anymore and it then fails. Small mystery solved 🎉 As an aside: This stopped working unconditionally at codegen time in Rust 1.78, for unknown reasons. Prior to that it worked with older |
Please take a look at #127 which contains all of the fixes. |
Thanks so much for the quick turnaround with a fix for this! Just chiming in to confirm that the fix in #127 works for artifacts built in GitHub runners: |
This is excellent, thank you @complexspaces and @ctz for the help, the fix, and the detailed information! 🎉 |
Hello 😊 We have discovered a weird runtime TLS bug happening for artifacts built on the GitHub Windows runners. We have an example repository showcasing a simplified example here:
https://github.com/Thomas-Avery/test-rustls-platform-verifier
You can find the built artifact here:
https://github.com/Thomas-Avery/test-rustls-platform-verifier/actions/runs/10378079748
The error when running this artifact:
The text was updated successfully, but these errors were encountered: