Comments (2)
The docs recommend that people create an access rule that allows anonymous writes to "up*" topics, so that you can use the matrix gateway and other UnifiedPush services, while still having auth-default-access: deny-all
from ntfy.
Now that I'm thinking more, it would probably be best to create some token that is unique to the UP topic and subscribing user, and pass that as the authentication token (instead of one specific to only the user). Then, at topic write-time, the service can check to see if the user is still subscribed to the UP topic, and deny/allow based on that. This would naturally expire stale authorizations.
This would require changes to both the authorization pathway in the go server, and proper calculation of those credentials:
- A new service provided to authenticated users that returns an encoding of (a) their username and (b) the hash of (their username, a server-wide secret string, and the UP topic name).
- The mobile apps should, at UP subscribe time, query the server for this token, appropriately embed it in the UP subscriber URL, and then pass it to the client app.
- The authentication chain in the server should check for this kind of token in URLs, and (a) confirm the hashes match, and (b) confirm the user is actually subscribed to the named topic.
Then, anyone with that secret token will be able to post to that topic name as long as the user is subscribed to it. Only constant additional state is required to be tracked by any parties. Similarly, only constant time is required to validate this. Unsubscribing and resubscribing the service will generate a new UP topic name, making the old token worthless (unless the up topic name happens to be reused by the same username, which is unlikely). As long as the server is updated to provide (1) and (3) first (which can be done without breaking backwards-compatibility), clients can gradually roll out support for (2), gracefully improving service. We could simultaneously change the up
prefix at this point, and keep the unconditional write-access to that for a while until everyone has transitioned.
Would patches that implement this be welcome? (Unfortunately, it would be a while before I could get to this. In particular I am probably going to try to debug #1035 first)
from ntfy.
Related Issues (20)
- Android: ntfy can be ended in the lock screen ...
- Android app shows ntfy icon at top even when there are no notifications HOT 3
- HTTPS error 50001 / http:500 / internal server error HOT 6
- Getting "ghost" messages on iOS for the past few days HOT 1
- Android app: Timestamp ignored in notifications
- New Browser Exentsion
- Postgres database option
- Multiple messages don't create new notifications on Chrome for Mac
- Timeout on topic subscription (self hosted behind Traefik) HOT 2
- ntfy filtering for mail over http
- Add webp support
- Can Firebase and Cache be disabled via the JSON payload? HOT 6
- Add utility functions to Message Templates
- Issue with Self-Hosted Ntfy Server and Self-Developed iOS Ntfy App Unable to Receive Instant Notifications
- Please remove default host from clients
- Ability to prevent attachments from loading on mobile network for Android
- deleting user doesn't delete corresponding topics which remain stale in database
- Will published in Huawei App Store?
- [Question] - FreeBSD Port HOT 2
- Add a Input / Output diagram to show Privacy and security behavior HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ntfy.