Fix updateCheck._updateWindowsRootCertificates() for Python 3.#11253
Merged
Conversation
This was missed in the migration to Python 3. There are two problems that needed to be addressed here: 1. We use https://www.nvaccess.org/nvdaUpdateCheck as the URL to get the certificate. However, that returns a 404. In Python 2, urllib didn't raise an exception for errors. In Python 3, it does. So, this was raising an exception and preventing us from getting any further. To fix this, pass versionType=stable as the query string, which will stop the server from throwing 404. 2. When getting the peer certificate, we need the raw SSL socket. In Python 3, the way to get that raw socket has changed slightly, so this code had to be adjusted accordingly.
Contributor
|
Hi, requesting high priority for 2020.2 please. Thanks.
|
josephsl
approved these changes
Jun 12, 2020
josephsl
left a comment
Contributor
There was a problem hiding this comment.
Thanks for catching this.
Collaborator
|
I wonder whether it could be helpful to hardcode the url in a function kwarg. This way the behavior doesn't differ when calling the function, but third party can reuse it for other urls. |
Contributor
Author
|
Yeah, I'd say that'd be useful, since Vocalizer Expressive at least copies
this. However, we should probably move it to a different module if we're
going to do that, and I didn't want to conflate these two issues with this
PR, especially as this is a more important fix.
|
Contributor
|
Hi, Add-on Updater also uses this function (maybe for 2020.3?). Thanks.
|
feerrenrut
approved these changes
Jun 12, 2020
Contributor
Author
|
Correct; #5871 is still a problem because this code can't handle redirects.
I think it'd be possible to fix that by writing code which manually tracked
and followed all the redirects for a given URL, running this cert update
code for each URL. That's not trivial, though, and probably involves
writing custom urllib request handlers, etc.
|
|
Is this allied to the issues I was having last week where certificates were
apparently not up to date when some alpha snaps tried to download the next
update?
I did in the end find that going back to an older update, then downloading
the latest seemed to make it work again, but I feel this was more luck than
anything else!
This was in Windows 7.
Brian
|
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.
Link to issue number:
Related to #4803.
Summary of the issue:
updateCheck._updateWindowsRootCertificatesis broken in Python 3. This will mean that a system which doesn't have the root SSL certificate used by nvaccess.org (e.g. a clean Windows install) won't be able to check for updates.Description of how this pull request fixes the issue:
This was missed in the migration to Python 3.
There are two problems that needed to be addressed here:
To fix this, pass versionType=stable as the query string, which will stop the server from throwing 404.
Testing performed:
I don't have a clean system to test this on, but I confirmed that I don't get any exceptions when I do this in the NVDA Python console:
Known issues with pull request:
None.
Change log entry:
Bug fixes:
- It is once again possible to check for NVDA updates on certain systems; e.g. clean Windows installs.