add validation of update mirror urls#17310
Conversation
…unction (nvaccess#17205) Moved the logic for parsing update check responses into a new function `parseUpdateCheckResponse`.
Co-authored-by: Sean Budd <seanbudd123@gmail.com>
SaschaCowley
left a comment
There was a problem hiding this comment.
Thanks @christopherpross. A couple of minor adjustments, plus I think you may have forgotten to push the schema validation.
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
|
Hi @christopherpross - just confirming you've seen Sascha's review and intend to still work on this? |
|
@seanbudd and @SaschaCowley sorry for the delay, my real life comes in the way. I am so sorry. If you have a deathline for this fix, someone can, if they want take this and fix the remaining missing code. I has forgotten something to push and deleted my local repo. So in the next few days I will try to get into this. But I understand fully if you have a deathline and you have to fix this issue fast. Sorry for the inconventience. |
…nd the updateCheck function. nvaccess#17205
|
@SaschaCowley and @seanbudd |
See test results for failed build of commit b58d91a109 |
SaschaCowley
left a comment
There was a problem hiding this comment.
Thanks @christopherpross. A few suggestions to improve the quality of the update check code while you're here. Please also update the copyright headers of the files you have touched to reflect that they have been modified in 2025, and add yourself to the list of copyright holders, if you like
See test results for failed build of commit 8a7529d07e |
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
…s#17205 Introduced the UpdateInfo dataclass to replace the dictionary used for update metadata. This improves type safety, readability, and maintainability by providing a structured and self-documenting representation of update information.
38a684f to
0a5a8e8
Compare
|
@SaschaCowley |
SaschaCowley
left a comment
There was a problem hiding this comment.
Some suggestions on how to make this more maintainable and performant, as well as on keeping to our coding standards.
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
9aeaeb1 to
2300559
Compare
|
@SaschaCowley Ok, I have applied the suggestions and documented the breaking changes. |
# Conflicts: # source/gui/settingsDialogs.py # user_docs/en/changes.md
Fixes #17811 Follow-up to #17310 Summary of the issue: Attempting to install a just-downloaded update fails on latest alphas. Description of user facing changes Update installation should work again Description of development approach Fixed several instances of property access on the `UpdateInfo` object using snake_case instead of camelCase. Testing strategy: Created a portable from source, spoofing the version and update version type: ```ps ./scons source version=2024.1 updateVersionType=stable ``` Ran the following tests: 1. Update and install immediately 1. Launch the portable 1. Check for updates, and download the update 1. When prompted, choose to install the update 1. Wait for the launcher to run, then cancel by answering No when asked whether to update the portable 1. Update and install later manually 1. Launch the portable 1. Check for updates, and download the update 1. When prompted, choose to postpone the update 1. Exit NVDA via the exit dialog, and choose to install the pending update 1. Wait for the launcher to run, then cancel by answering No when asked whether to update the portable 1. Update and install later when prompted 1. Launch the portable 1. Check for updates, and download the update 1. When prompted, choose to postpone the update 1. Restart the portable 1. When prompted, choose to install the pending update 1. Wait for the launcher to run, then cancel by answering No when asked whether to update the portable Known issues with pull request: None.
Link to issue number:
Fixes #17205
Summary of the issue:
Users could configure an invalid update mirror URL, which would only be discovered when attempting to check for updates. This PR implements a validation mechanism that ensures the specified update mirror is valid before allowing it to be set in the settings.
Description of user facing changes
A new validation process has been added when setting an update mirror URL in NVDA's settings. Users will now receive feedback if the URL they provide is not a valid update mirror. The "Test" button in the settings will now ensure that the mirror responds with the expected format, preventing invalid configurations.
Description of development approach
parseUpdateCheckResponse.versionlauncherUrlapiVersion_isResponseUpdateMirrorValidinsettingsDialogs.py, which callsparseUpdateCheckResponseto validate the mirror's response._isResponseUpdateMirrorValidas theresponseValidatorin the_SetURLDialogfor update mirrors.Testing strategy:
Known issues with pull request:
No known issues.
Code Review Checklist:
@coderabbitai summary