Use root certificates when using the add-on store and NVDA remote#18528
Conversation
|
I do not know if it is still applicable or not. But if yes, please check that |
8d1e41b to
91b4511
Compare
|
@CyrilleB79 - I cannot reproduce that issue when running this PR from source. |
There was a problem hiding this comment.
Pull Request Overview
This PR improves NVDA's SSL/TLS certificate verification by switching from the default certifi certificate bundle to Windows root certificates, particularly addressing issues when accessing the add-on store in corporate environments.
- Adds truststore dependency and injects it at startup to use Windows root certificates
- Implements centralized certificate handling with automatic root certificate updates
- Enhances add-on download process with user prompts for untrusted certificates
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Adds truststore dependency to override certifi |
| source/core.py | Injects truststore at startup to use Windows certificates |
| source/utils/networking.py | New module centralizing certificate handling and URL fetching |
| source/updateCheck.py | Refactors to use centralized networking utils |
| source/addonStore/dataManager.py | Updates to use centralized certificate handling |
| source/addonStore/network.py | Enhances download process with certificate verification prompts |
| source/_remoteClient/transport.py | Updates SSL context configuration |
| user_docs/en/changes.md | Documents changes for users and developers |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Confirm that running from source successfully downloads add-ons. |
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
…mote (#18528)" (#19106) This reverts commit 2fa3658. ### Reverts PR Reverts #18528 ### Issues fixed Fixes #19076 ### Issues reopened Reopens #15905 ### Reason for revert - Add-on API solution doesn't work - extracting SSL from context is dangerous - Regression with NVDA remote ### Can this PR be reimplemented? If so, what is required for the next attempt - Instead use trust store directly rather than injecting into all SSL contexts
Link to issue number:
Reimplements #18354
Reimplements #18490
Reimplements #18402
Fixes #15905
Summary of the issue:
When trying to download an add-on from the add-on store in certain environments such as corporates, the download fails due to the machine not trusting the root certificate of the add-on source.
This can be caused by two issues:
When performing an update check, we update windows root certificates if our certificate is invalid or out of date.
Description of user facing changes:
NVDA should more reliably trust request endpoints using windows root certificates. e.g. accessing the add-on store in a corporate environment.
Description of developer facing changes:
requests and similar libraries now has truststore injected into it
Description of development approach:
This pull request improves how NVDA handles SSL/TLS certificate verification, particularly for HTTPS requests and add-on downloads. It ensures that the application uses the Windows root certificate store instead of the Python default (certifi), provides a fallback mechanism to update root certificates when encountering untrusted certificates, and enhances user interaction when certificate errors occur during add-on downloads. Additionally, shared networking logic has been refactored and centralized for maintainability.
Certificate Verification and Networking Improvements:
truststoredependency and injected it at startup so that allrequestsHTTP calls use the Windows root certificate store instead of certifi, improving compatibility in corporate and managed environments. (pyproject.toml,source/core.py) [1] [2] [3]utils/networking.pymodule that centralizes logic for fetching URLs, handling certificate verification errors, and updating Windows root certificates. This includes helper functions like_fetchUrlAndUpdateRootCertificates,_getCertificate, and_updateWindowsRootCertificates. (source/utils/networking.py)Add-on Store and Update Check Enhancements:
_fetchUrlAndUpdateRootCertificatesfunction, ensuring robust handling of certificate verification failures and automatic root certificate updates when necessary. (source/addonStore/dataManager.py,source/updateCheck.py) [1] [2] [3] [4] [5]source/addonStore/network.py) [1] [2]Codebase Cleanup and Refactoring:
updateCheck.pyand centralized all certificate handling inutils/networking.py. (source/updateCheck.py)source/addonStore/network.py) [1] [2] [3] [4] [5]Testing strategy:
Known issues with pull request:
None
Code Review Checklist:
@coderabbitai summary