Skip to content
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

[surepetcare] Adapt blocked user agent #15047

Merged
merged 2 commits into from
Jun 2, 2023

Conversation

jlaur
Copy link
Contributor

@jlaur jlaur commented Jun 1, 2023

Fixes openhab#15046

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
@jlaur jlaur added the bug An unexpected problem or unintended behavior of an add-on label Jun 1, 2023
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/sure-petcare-binding-login-failure-due-to-rejected-http-user-agent/146992/4

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
@jlaur jlaur force-pushed the 15046-surepetcare-fix-user-agent branch from 0a3ba46 to 9da8b0c Compare June 1, 2023 18:45
@jlaur jlaur marked this pull request as ready for review June 1, 2023 18:53
@jlaur jlaur requested a review from renescherer as a code owner June 1, 2023 18:53
@jlaur jlaur requested a review from a team June 1, 2023 18:53
@jlaur
Copy link
Contributor Author

jlaur commented Jun 1, 2023

@openhab/add-ons-maintainers - please consider this for being cherry-picked into 3.4.x since the previous hardcoded user-agent has recently been blocked, so the binding doesn't work anymore.

@renescherer
Copy link
Contributor

Thanks very much for the PR!

@jlaur
Copy link
Contributor Author

jlaur commented Jun 2, 2023

Thanks very much for the PR!

You're very welcome, it was an easy fix, let's see if it will last. 🙂

@J-N-K
Copy link
Member

J-N-K commented Jun 2, 2023

Is Jetty blocked by SurePetCare or why do we change the user agent at all?

@jlaur
Copy link
Contributor Author

jlaur commented Jun 2, 2023

Is Jetty blocked by SurePetCare or why do we change the user agent at all?

See the linked issue or forum post. The previous hardcoded user-agent is blocked.

@J-N-K
Copy link
Member

J-N-K commented Jun 2, 2023

Yes, but that is already user agent that is not the default. The default is something like
Jetty/9.2.4.v20141103. My question was: Why do we set a user agent at all.

@jlaur
Copy link
Contributor Author

jlaur commented Jun 2, 2023

Yes, but that is already user agent that is not the default. The default is something like Jetty/9.2.4.v20141103. My question was: Why do we set a user agent at all.

Why do you think it's better to expose "Jetty" rather than "openHAB"?

@splatch
Copy link
Contributor

splatch commented Jun 2, 2023

Why do you think it's better to expose "Jetty" rather than "openHAB"?

A privacy concern. ;)

@J-N-K
Copy link
Member

J-N-K commented Jun 2, 2023

It's not "better". I'm just wondering if it is necessary.

@J-N-K J-N-K added this to the 4.0 milestone Jun 2, 2023
@J-N-K J-N-K merged commit 3c1cbaa into openhab:main Jun 2, 2023
@jlaur
Copy link
Contributor Author

jlaur commented Jun 2, 2023

It's not "better". I'm just wondering if it is necessary.

It's an interesting problem, and I'm not sure what is best.

In an ideal world I think it would be best to provide the user-agent as accurate (honest, if you will) as possible. Service providers can then use this for analysis of incoming traffic, or even to block very old (or misbehaving) clients like in this case.

The actual HTTP client in this case is Jetty, but I think it's more relevant to know that the traffic is from the openHAB integration. It might even be best to include both, e.g. "openHAB/4.0.0 Jetty/9.2.4.v20141103)". I don't remember if this is done by Jetty already, or only in case of 3xx redirects, but I'll check.

@jlaur
Copy link
Contributor Author

jlaur commented Jun 2, 2023

@openhab/add-ons-maintainers - please consider this for being cherry-picked into 3.4.x since the previous hardcoded user-agent has recently been blocked, so the binding doesn't work anymore.

@J-N-K - okay for you to cherry-pick to 3.4.x?

@jlaur
Copy link
Contributor Author

jlaur commented Jun 7, 2023

The actual HTTP client in this case is Jetty, but I think it's more relevant to know that the traffic is from the openHAB integration. It might even be best to include both, e.g. "openHAB/4.0.0 Jetty/9.2.4.v20141103)". I don't remember if this is done by Jetty already, or only in case of 3xx redirects, but I'll check.

Logged as "Jetty/9.4.50.v20221201, openHAB/4.0.0".

@jlaur jlaur deleted the 15046-surepetcare-fix-user-agent branch June 7, 2023 21:02
tb4jc pushed a commit to tb4jc/openhab-addons that referenced this pull request Jun 19, 2023
* Adapt blocked user agent

Fixes openhab#15046

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Thomas Burri <thomas.burri@alstomgroup.com>
matchews pushed a commit to matchews/openhab-addons that referenced this pull request Aug 9, 2023
* Adapt blocked user agent

Fixes openhab#15046

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Matt Myers <mmyers75@icloud.com>
@jlaur jlaur mentioned this pull request Sep 19, 2023
austvik pushed a commit to austvik/openhab-addons that referenced this pull request Mar 27, 2024
* Adapt blocked user agent

Fixes openhab#15046

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on community approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[surepetcare] Login failure due to rejected HTTP user agent
5 participants