8 ms·
See my other post for a discussion of non-user security topics. Every app user has a database user, mapped 1:1, so there are no credentials to leak. The DB cre
by mike_hearn 4y ago
See my other post for a discussion of non-user security topics.
Every app user has a database user, mapped 1:1, so there are no credentials to leak. The DB credentials are the user credentials. In the demo app repository I implement open signup with email confirmation using stored procedures/a server extension. It works by creating a guest user with a well known password, but it's locked down so that the only things it can do are run a couple of stored procedures. Those then send an email to confirm ownership of the address before creating a real DB user.
Open work: don't use passwords, mint SSL client certificates during signup with the private key stored in the OS keystore. Now there's no cookies or passwords to steal! Also, OAuth integration.
The guest user / open signup is certainly a weakness for the demo, which is public on the internet (a dedicated cluster though). It's locked down as much as possible but there are probably lots of ways to screw with the server even without being granted access to anything. And there are no rate limits on signup. It's really a very basic exploration.
- conceptme 4y agoConnections are pretty expensive in PG how can you do pooling if every user connects directly?
- giovannibonetti 4y agoConnection poolers like PgBouncer [1] (traditional) and Supabase's Supavisor [2] (new) come to mind. [1] https://www.pgbouncer.org/ https://www.pgbouncer.org/ [2] https://github.com/supabase/supavisor https://github.com/supabase/supavisor
- mike_hearn 4y agoSupavisor looks great. Unclear if it can be configured to use https://github.com/pgaudit/set_user https://github.com/pgaudit/set_user though. That said, there are quite a lot of CRUD apps in the world that don't need to support lots of simultaneous users, or where you can just add read replicas quite cheaply. Think internal apps, dashboards, etc.