Repository navigation
Mac: https works on a Mac without the Python the app was built with - #45
Merged
Merged
Conversation
The built app's OpenSSL looks for certificate authorities in /Library/Frameworks/Python.framework/Versions/3.12/etc/openssl. A Mac that never had that Python has nothing there, so the update check, the update download and a brain on the internet all failed with CERTIFICATE_VERIFY_FAILED (seen on the MacBook Pro 2019 with 1.10.0 and 1.13.0). When Python's own places hold no authority, Buddy now uses the ones macOS ships: /etc/ssl/cert.pem, else Apple's root keychain. Certificate and host name checks stay on. The self-test has a check for it.
Collaborator
Author
|
Tried the app this pull request builds (
One other check, Still not done: a real update check from this build after a normal start (it logs nothing when it succeeds, and it needs a newer release to exist). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
Buddy Lite for Mac could not make any https call on the MacBook Pro 2019 (Intel, macOS 15.7). Every update check in its log failed:
It was the same with 1.10.0 and, after installing it, with 1.13.0. The brain goes through the same kind of call, so a brain on the internet fails the same way.
Cause. The built app carries its own OpenSSL.
stringson itslibcrypto.3.dylibshows where it looks for certificate authorities:/Library/Frameworks/Python.framework/Versions/3.12/etc/openssl, the folder of the Python the app was built with. That Mac has no Python 3.12, so there is nothing there, and the app ships no certificates of its own.Why the tests did not see it. The self-test talks to a brain on the same computer, and the updater tests read the manifest from a file. Nothing made an https call from the built app.
The change
mac/buddy_mac/certs.py: when Python's own places hold no certificate authority, use the ones macOS ships:/etc/ssl/cert.pem, and if that is missing or empty, Apple's root keychain throughsecurity find-certificate. Certificate and host name checks stay on. The log says once where the authorities came from.core._open(the brain) and both routes ofupdater._open(update check and download) use that context.https_certificates, and writes the source intoreport.json.Checked on the MacBook Pro 2019
/usr/local/bin/python3on that Mac (python.org 3.14, no certificates installed) fails the same way as the app, so Buddy's own updater code was run under it from source:could not reach https://juw12.github.io/buddy/latest.json ... CERTIFICATE_VERIFY_FAILEDhttps certificates: macos file (128 authorities), manifest read, Mac version 1.13.0. A call to the free brain got an HTTP answer (403 to a bare test request), so the connection itself is made.SSL_CERT_FILE=/etc/ssl/cert.pem, logged no update failure. Without it the failure came 60 s after every start.pytest mac/tests: 59 passed (8 new intest_certs.py; they need no network and no Mac).Not checked
SSL_CERT_FILEstill works for that, because Python's own places are asked first.After merging
An installed Buddy on a Mac with this problem cannot fetch the update that fixes it. It needs the install line once:
curl -fsSL https://juw12.github.io/buddy/mac-install.sh | bash.