-
-
Notifications
You must be signed in to change notification settings - Fork 745
Propagate CLI arguments when updating #16937
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
Conversation
… than strings directly, so we can set flags or options multiple times without worrying about duplicates
- Refactored the command line argument generation into a helper function. - Fixed a typo where command line options were included twice and flags weren't included.
for more information, see https://pre-commit.ci
…nto propagateCliArgs
WalkthroughThe recent updates enhance the functionality and maintainability of the NVDA application. Key improvements include refined error handling in the update process, ensuring valid paths are provided, and introducing a new function for generating update parameters. Additionally, command line options now fully respect user configurations during updates, while a bug fix improves caret movement tracking, aligning it with user expectations and improving overall responsiveness. Changes
Recent review detailsConfiguration used: .coderabbit.yml Files selected for processing (2)
Additional context usedPath-based instructions (2)
Additional comments not posted (5)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
seanbudd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach generally looks good to me, nice work on this
|
When the update is complete and the newly installed NVDA starts, should it also receive the same commandline parameters? |
There isn't the same risk here, as the new copy will not be running as administrator. However, if you still think the arguments should be propagated, I'm happy to do so. |
|
pre-commit.ci run |
|
I'm puzzled. Even when updating, NVDA itself doesn't run as admin, only nvda_slave will be running elevated. I would personally also force the command line parameters on the copy after update, that is, as long as this is also done on a normal restart using the restart dialog. |
Apologies, this comment was based on a misunderstanding of mine.
We currently propagate most arguments when restarting, with the notable exception of |
|
I have now updated the installer to propagate the |
|
@coderabbitai review |
seanbudd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice approach for _generate_executionParameters!
…s its own configuration (#18443) ### Link to issue number: Closes #18442 Fix-up of #16937 ### Summary of the issue: When creating a portable NVDA and asking to launch it immediately after creation, the portable copy does not use its own config, but the one of the NVDA it had been created from. In #16937, we propagate `--disable-addons` as well as `-c` / `--config-path` for security reasons so that an administrator can update from a user account using their own config folder, without risking to use malicious add-ons in the user's configuration (see [GHSA-727q-h8j2-6p45](GHSA-727q-h8j2-6p45)). ### Description of developer facing changes: N/A ### Description of development approach: * When creating a portable copy, do not pass parameters to the new instance. In any case, there is no UAC, so no risk of privilege escalation. * Parameters are still being passed to the new instance during an update. * When installing a new copy, I have kept parameters of original NVDA. ### Testing strategy: * portable creation: uses its own configuration * portable update: uses the configuration of the previous portable, even, for example when using `-c` flag
Link to issue number:
None
Summary of the issue:
When updating NVDA, command line arguments are not passed from the running copy to the temporary copy. This may have security implications for arguments such as
-cor--disable-addons.Description of user facing changes
The
-c/--config-pathand--disable-addonsarguments are now propagated to the temporary copy of NVDA when an update is started from within NVDA.Description of development approach
Refactored
updateCheck._executeUpdateto use a helper function to generate the parameters to call the launcher with. In addition to the parameters that were already passed, the following parameters are now passed:globalVars.appArgs.disableAddonsisTrue, the--disable-addonsflag is passed.--config-pathargument is passed with the current configuration directory. We do not directly pass the path that NVDA was called with because:-cwasn't specified at the CLI, it will be the default config path, which is what NVDA would have defaulted to anyway.sys.argvto find-cor--config-pathadds a performance overhead (and code complexity) for no benefit, because anyone fiddling around to changeglobalVars.appArgs.configPathorNVDAState.WritePaths.ConfigDircan changesys.argvtoo.Testing strategy:
Set
buildVersion.version_major = 1, and built a launcher withupdateVersionType=stable(since the current stable version is 2024.2).Created a dummy add-on that beeps at NVDA start-up.
For each of the following test cases, I installed the dummy add-on and changed the synthesiser to eSpeak so it was easy to tell if the test cases were working as expected. The test cases were performed on installed and portable copies of NVDA as created with the launcher generated above.
The following tests were performed:
nvda.exe. Updated NVDA and observed the add-on was run and customised settings were used.nvda.exe --disable-addons. Updated NVDA and observed the add-on was not run but customised settings were used.nvda.exe -c c:\test(nonexistant directory). Updated NVDA and observed the add-on was not run and default settings were used.Known issues with pull request:
NVDA should ideally be refactored so that there is a single source of truth for its CLI args, as they're currently repeated in multiple places (
nvda.pyw,globalVars.py,updateCheck.pyand possibly others).Code Review Checklist:
Summary by CodeRabbit
New Features
Bug Fixes
Refactor