mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 16:35:53 +02:00
[GH-ISSUE #535] Websocket failures are indistinguishable #410
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#410
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @alexhorner on GitHub (Dec 8, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/535
When you're unauthroised on a websocket, wrong credentials or none provided, the response code is a 200 but the debug log on the server reports unauthorized. I think it should be 403 or 401, not 200.
Additionally, If a proxy fails and returns an incorrect page with a 200, my app says credential failure, when that definitely isn't, it's a connection failure, but it is currently not possible to differentiate this with ntfy.sh's behaviour.
@binwiederhier commented on GitHub (Mar 13, 2023):
I realized that this is very very easy to do. I do not fully know how clients would react though, which I suppose is the hardest part, to test this.
It'd be to call
w.WriteHeader(httpErr.HTTPCode)here: https://github.com/binwiederhier/ntfy/blob/main/server/server.go#L331-L339, maybe also adding aX-Ntfy-Errorheader to return the error message, or something.Not entirely sure if there is a better way for websocket errors to return error messages
@alexhorner commented on GitHub (Mar 13, 2023):
@binwiederhier I'm not sure it could break clients any more than they are broken already?
Having tested, my websocket client expects a code 101 for switching protocol to websocket. It instead receives a 200 which it does not expect and causes it to throw.
Considering it never establishes a valid websocket connection anyway, and no sense can be made of the 200, I would expect that a client would already (like mine) be just rejecting anything that isn't a 101 as a fault. Being more specific about what that fault is would certainly be useful.