-
Notifications
You must be signed in to change notification settings - Fork 317
Fix '--get security' (incorrect AdminMessage.ConfigType value). #907
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -170,11 +170,10 @@ def requestConfig(self, configType): | |
| p.get_config_request = configType | ||
|
|
||
| else: | ||
| msgIndex = configType.index | ||
| if configType.containing_type.name == "LocalConfig": | ||
| p.get_config_request = msgIndex | ||
| p.get_config_request = admin_pb2.AdminMessage.ConfigType.Value(configType.name.upper() + "_CONFIG") | ||
| else: | ||
| p.get_module_config_request = msgIndex | ||
| p.get_module_config_request = configType.index | ||
|
Comment on lines
175
to
+176
|
||
|
|
||
| self._sendAdmin(p, wantResponse=True, onResponse=onResponse) | ||
| if onResponse: | ||
|
|
||
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.
AdminMessage.ConfigType.Value(configType.name.upper() + "_CONFIG")will raiseValueErrorif aLocalConfigfield doesn’t have a correspondingConfigTypeenum (e.g.LocalConfig.version). BecauserequestConfig()is reachable from the CLI via--get <field>, this becomes an uncaught exception for a user typo/unsupported field. Consider catching the error (or checking membership in the enum) and exiting with a clear message (or explicitly rejectingversion).