We're updating the issue view to help you get more done. 

error if password stored in config file contains a '%'

Description

Tried to login with a config file. Got the following (partly redacted because it contains a password):

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 In [11]: syn = synapseclient.Synapse(configPath="/path/to/my/configFile") In [12]: syn.login(silent=True) --------------------------------------------------------------------------- InterpolationSyntaxError Traceback (most recent call last) <ipython-input-12-485e1f762e1c> in <module> ----> 1 syn.login(silent=True) ~/.virtualenvs/bucketmover/lib/python3.6/site-packages/synapseclient/client.py in login(self, email, password, apiKey, sessionToken, rememberMe, silent, forced) 384 # TODO: remove deprecated sessionToken when we move to a different solution 385 self.credentials = credential_provder_chain.get_credentials(self, UserLoginArgs(email, password, apiKey, forced, --> 386 sessionToken)) 387 388 # Final check on login success ~/.virtualenvs/bucketmover/lib/python3.6/site-packages/synapseclient/credentials/credential_provider.py in get_credentials(self, syn, user_login_args) 113 """ 114 for provider in self.cred_providers: --> 115 creds = provider.get_synapse_credentials(syn, user_login_args) 116 if creds is not None: 117 return creds ~/.virtualenvs/bucketmover/lib/python3.6/site-packages/synapseclient/credentials/credential_provider.py in get_synapse_credentials(self, syn, user_login_args) 34 :return: `SynapseCredentials` if valid credentials can be found by this provider, None otherwise 35 """ ---> 36 return self._create_synapse_credential(syn, *self._get_auth_info(syn, user_login_args)) 37 38 def _create_synapse_credential(self, syn, username, password, api_key): ~/.virtualenvs/bucketmover/lib/python3.6/site-packages/synapseclient/credentials/credential_provider.py in _get_auth_info(self, syn, user_login_args) 74 """ 75 def _get_auth_info(self, syn, user_login_args): ---> 76 config_dict = syn._get_config_authentication() 77 # check to make sure we didn't accidentally provide the wrong user 78 username = config_dict.get('username') ~/.virtualenvs/bucketmover/lib/python3.6/site-packages/synapseclient/client.py in _get_config_authentication(self) 410 411 def _get_config_authentication(self): --> 412 return self._get_config_section_dict(config_file_constants.AUTHENTICATION_SECTION_NAME) 413 414 def _get_client_authenticated_s3_profile(self, endpoint, bucket): ~/.virtualenvs/bucketmover/lib/python3.6/site-packages/synapseclient/client.py in _get_config_section_dict(self, section_name) 404 config = self.getConfigFile(self.configPath) 405 try: --> 406 return dict(config.items(section_name)) 407 except configparser.NoSectionError: 408 # section not present /usr/lib64/python3.6/configparser.py in items(self, section, raw, vars) 856 if raw: 857 value_getter = lambda option: d[option] --> 858 return [(option, value_getter(option)) for option in d.keys()] 859 860 def popitem(self): /usr/lib64/python3.6/configparser.py in <listcomp>(.0) 856 if raw: 857 value_getter = lambda option: d[option] --> 858 return [(option, value_getter(option)) for option in d.keys()] 859 860 def popitem(self): /usr/lib64/python3.6/configparser.py in <lambda>(option) 853 d[self.optionxform(key)] = value 854 value_getter = lambda option: self._interpolation.before_get(self, --> 855 section, option, d[option], d) 856 if raw: 857 value_getter = lambda option: d[option] /usr/lib64/python3.6/configparser.py in before_get(self, parser, section, option, value, defaults) 392 def before_get(self, parser, section, option, value, defaults): 393 L = [] --> 394 self._interpolate_some(parser, option, L, value, section, defaults, 1) 395 return ''.join(L) 396 /usr/lib64/python3.6/configparser.py in _interpolate_some(self, parser, option, accum, rest, section, map, depth) 442 option, section, 443 "'%%' must be followed by '%%' or '(', " --> 444 "found: %r" % (rest,)) 445 446 InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%1.................'

I tried to single or double quote the password field, the same error occured.

Environment

Python 3.6

Status

Assignee

Kimyen Truong

Reporter

Kenneth Daily

Validator

Kenneth Daily

Fix versions

Priority

Major