Fix cookie-jar pollution; remove dead QR login code; add tests
The reauth flow ran validate_jsessionid against HA's shared aiohttp
session, then update_cookies({"JSESSIONID": ...}) added the new value
with no domain. aiohttp's cookie jar still held the previous
JSESSIONID pinned to smartthingsfind.samsung.com (set via Set-Cookie
during the previous load), and aiohttp prefers the more-specific
domain match — so the *stale* cookie went out, Samsung returned no
_csrf header, and the user saw "Cookie was rejected by SmartThings
Find" even though their cookie was fine.
Two fixes:
* validate_jsessionid now runs in an isolated aiohttp.ClientSession
with its own jar, so the shared HA jar can't shadow the cookie
under test.
* async_setup_entry clear_domain()s the smartthingsfind.samsung.com
cookies before reseating JSESSIONID with response_url, otherwise
the same shadowing breaks the entry reload that follows a
successful UI reauth.
Also remove the QR-code login code (do_login_stage_one / _two,
gen_qr_code_base64, the legacy URL constants and qrcode/base64/
random/string/re/asyncio/io/timedelta imports) — Samsung migrated
account.samsung.com to a SPA-driven IAM/OAuth2 flow months ago, so
the QR scrape no longer works and nothing in the integration
references those helpers anymore. Drops the qrcode/pillow/requests
manifest requirements.
Tests: a minimal conftest stubs the homeassistant.* imports the
integration uses, and four async tests cover validate_jsessionid
including the regression case where a domain-bound stale cookie
sits in the shared jar.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7457a8284b
commit
4c26792c37
6 changed files with 287 additions and 227 deletions
|
|
@ -2,13 +2,13 @@
|
|||
"domain": "smartthings_find",
|
||||
"name": "SmartThings Find",
|
||||
"after_dependencies": ["http"],
|
||||
"version": "0.3.0",
|
||||
"version": "0.3.1",
|
||||
"documentation": "https://git.jeena.net/jeena/HA-SmartThings-Find",
|
||||
"issue_tracker": "https://git.jeena.net/jeena/HA-SmartThings-Find/issues",
|
||||
"integration_type": "hub",
|
||||
"dependencies": [],
|
||||
"codeowners": ["@jeena"],
|
||||
"requirements": ["requests", "qrcode[pil]", "pillow", "pytz"],
|
||||
"requirements": ["pytz"],
|
||||
"iot_class": "cloud_polling",
|
||||
"config_flow": true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue