sstratoti / homeassistant-snoo

BSD 2-Clause "Simplified" License
5 stars 2 forks source link

Config Flow is using string interpolation for password fields? #2

Open niemyjski opened 3 years ago

niemyjski commented 3 years ago

This error kind of scared me a bit as passwords shouldn't be getting string interpolated. I wanted to log it and if I have time dig in.

2021-03-07 13:21:31 ERROR (MainThread) [custom_components.snoo.config_flow] Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/snoo/config_flow.py", line 52, in async_step_user
info = await validate_input(self.hass, user_input)
File "/config/custom_components/snoo/config_flow.py", line 36, in validate_input
result = await hass.async_add_executor_job(
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/snoo/config_flow.py", line 22, in fetch_token
client.auth["password"] = password
File "/usr/local/lib/python3.8/configparser.py", line 1259, in __setitem__
return self._parser.set(self._name, key, value)
File "/usr/local/lib/python3.8/configparser.py", line 1201, in set
super().set(section, option, value)
File "/usr/local/lib/python3.8/configparser.py", line 894, in set
value = self._interpolation.before_set(self, section, option,
File "/usr/local/lib/python3.8/configparser.py", line 402, in before_set
raise ValueError("invalid interpolation syntax in %r at "
ValueError: invalid interpolation syntax in 'TE%st0001'
sstratoti commented 3 years ago

Please do! I forked this from the original and was toying with it to try to get the username and password to save between restarts of HA. I'm a total beginner at python, so its entirely likely that I'm doing something wrong. I was trying to model it off of other delivered integrations to get the data to store.

SelfSufficient08 commented 3 years ago

@sstratoti - this is really great to use. I see in your comment about the credentials not sticking after a reboot. I am guessing this is why at each reboot I need to remove and re-add the integration. Correct?

niemyjski commented 3 years ago

@jplivingston08 I'm noticing the same thing. Can you create a new issue for this / create a pr.

niemyjski commented 5 months ago

@jplivingston08 did you have any luck