fix: reject invalid/expired stream authSig with 403 (avoid HA IP bans) - #956
Open
joyjit wants to merge 1 commit into
Open
fix: reject invalid/expired stream authSig with 403 (avoid HA IP bans)#956joyjit wants to merge 1 commit into
joyjit wants to merge 1 commit into
Conversation
Home Assistant's HTTP ban middleware counts every HTTPUnauthorized as a failed login. Sleeping dashboard tabs that reconnect with an expired authSig were self-banning client IPs (especially behind use_x_forwarded_for). Raise HTTPForbidden so the stream is still denied without touching the login ban counter. Fixes AlexxIT#955
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
authSig(and bad HLS session cookie) previously raisedHTTPUnauthorized(401).login_attempts_thresholdhits — including a household WAN address behinduse_x_forwarded_for.HTTPForbidden(403) instead: stream still rejected, login ban counter untouched.Fixes #955
Test plan
custom:webrtc-camera, confirm live stream still works (freshauth/sign_path→ websocket upgrade).login_attempts_threshold≥ 1, send multiple/api/webrtc/wsrequests with garbageauthSig(optionally viaX-Forwarded-Forthrough a trusted proxy): expect 403, noLogin attempt or request with invalid authenticationlog lines, IP not added toip_bans.yaml./api/stateswithout token) still increments failed logins / can ban — protection unchanged.Verified locally on HA with WebRTC v3.6.1 using the above probe pattern before opening this PR.