Resolve variable masking issue in ui.browseableMessage#16380
Merged
Conversation
seanbudd
approved these changes
Apr 11, 2024
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:
Fix-up of PR from GHSA-xg6w-23rw-39r8.
Summary of the issue:
A masking issue was found in
ui.browseableMessagewhere we try to call the module level functionmessagebut it is masked by the local variablemessagewhich is an argument ofui.browseableMessage.Description of user facing changes
In case an installation cannot create a
Scripting.DictionaryCOM object, a message will now be reported.Description of development approach
I access the module level
messagefunction throughglobals()dictionary and store it in a new local variable to use it.It would have been cleaner to rename the argument of
ui.browseableMessagebut I have not done so because changing the signature of a function is API-breaking.I have also caught one more exception type because I have realized while testing that calling
comtypes.client.CreateObjectwith an unknown class string raisesOSError.Testing strategy:
Manual test: modify the class string to force the exception. E.g. call:
comtypes.client.CreateObject('Scripting.TestUnexistingClass')Known issues with pull request:
None
Change log
Not needed: I guess no one has ever fallen in this code path.
Note
I have found this issue while doing tests.
But fortunately, I have not found any plateform where
Scripting.Dictionarycannot be created.Code Review Checklist: