-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Use Captcha for BMW North America #129667
Conversation
Hey there @gerard33, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
@@ -186,9 +256,55 @@ async def async_step_account_options( | |||
) | |||
|
|||
|
|||
class BmwCaptchaView(HomeAssistantView): |
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.
I'd move that to view.py
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.
I kept it in config_flow.py
as I got many ideas from the Plex integration.
There, the views related to the config flow are in config_flow.py
and only views that are used after component initialization are in views.py
.
Maybe someone from the core team can give some feedback here as well because it seems this is the first time an actual HTML page is rendered from HA - I was only able to find images/API-like functionality.
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.
Can we bump the library in a preliminary PR?
Then we can iterate over the extra changes without triggering a full CI every time
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Sure thing, done in #129838 (including the now required additional exception handling). |
Merged in current dev (including dependency bump) and looking forward to your comments. |
Thanks for splitting out the dependency bump. (note: you can remove the links to the dep bump in the description now) |
<button type="submit">Submit</button> | ||
</center> | ||
</form> | ||
<script src="https://hcaptcha.com/1/api.js" async defer></script> |
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.
External javascript included into the Home Assistant frontend.
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.
So, we have discussed this PR extensively with the team, and concluded we cannot accept this pull request. The main reason, is that it includes external javascript into the Home Assistant frontend. This means, this piece of javascript can access anything, all login/session tokens of the current user, giving access to all Home Assistant APIs.
We are aware that this decision will impact all users of the BMW integration (as the Captcha at this point has been rolled out worldwide), but the security of Home Assistant as a whole is more important and should be guarded for.
I've been discussing options with @rikroe and we are going to explorer further. I'm also going to ask if the partnership folks @ NabuCasa can help out and see if we can reach out to BMW regarding all of this.
So, for now, I'm closing this PR for the above mentioned (and also hightlighed/marked) reasoning.
To be continued...
../Frenck
Proposed change
BMW have implemented a captcha solution for the North America region when loggin in using username & password.
Once logged in and using refresh tokens, the captcha is not required anymore.
This PR adds an external step to the config flow for North America and just shows the required captcha widget from a HomeAssistantView.
If during normal operation, the refresh token flow fails, a reauthentication flow with a captcha-specific error message will be triggered.
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: