Notifications on phones while NeoKOM is in the background (Web Push) #135
Labels
No labels
area/ci
area/desktop
area/packaging
area/protocol
area/reading
area/ui
area/web
area/writing
kind/bug
kind/feature
kind/infra
kind/request
needs/user
parked
perf
security
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
littlefox/neokom#135
Loading…
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?
On a phone, the browser freezes NeoKOM soon after it goes to the background (and closes its WebSocket), so it doesn't hear about new posts and can't notify. The notifications from #103 only work while the page is still running.
Fixing that needs Web Push: something that stays connected to LysKOM for the person and sends a push message to the phone's push service. That would be the relay, holding a logged-in session, or a second session per person, which changes what the relay is (today it only forwards bytes, D-040).
Needs a decision from the user before any work: whether a server-side component may stay logged in on someone's behalf, and where it runs.
I assume there would be some security implications with holding sessions open on the relay. The relay would have to cache the user password or have some authentication mechanism when connecting to the relay.
Yes. That's the core of it. LysKOM has no tokens or app passwords: the only way to log in is person + password (Protocol A
login). So whatever stays connected for someone either holds the password, or holds a session that was opened with it.What changes, and what doesn't
Already true today. The relay terminates the browser's TLS and passes the login request on, so it sees the password in transit at every login. Users already trust the relay operator with that. Holding sessions changes how long a credential lives: from "during one connection, in memory" to "hours or days".
Risks, roughly biggest first:
Options
A. The password stays in memory only. A separate small push service; I'd keep it out of the byte-forwarding relay, so the relay stays simple to audit.
B. Keep the browser's own session when the page goes away. The relay doesn't close the lyskomd connection when the WebSocket drops; it watches it, and the page reattaches with a secret token.
C. Stored, encrypted password. It survives restarts, but it's risk 1. Not recommended.
D. No server. Android only lets an installed web app sync in the background rarely (Periodic Background Sync, about every 12 h at best). That's useless for this.
Worth knowing: iPhones only get Web Push for apps added to the home screen (iOS 16.4 and later).
My recommendation
A, opt-in per device, with:
Questions for you
I need to think some more before I answer these questions fully. But the intended end-goal is to run a public relay on lysator. Lyskomd admins should be fine with it, since there are already other types of relays and, since passwords pass the "last mile" as plain-text anyway, security is rather relaxed in general. Paused notifications are perfectly fine.
This is a massive limitation of Protocol A. I want to file this away for a rainy day when I can think about drafting some proposals for extentions of the protocol
Thanks. Recorded as D-043 (PR #139). Aimed at the public deployment, pausing after a restart is fine, and 0.3 ships without it. The protocol idea is filed as #138. This issue stays open with needs/user until you've decided on the design.
Parking this issue for now. Important for future usability, but currently not possible to achieve safely and effectively.