Secure database-driven applications on Neocities
fauna.com
fauna.com
If there's a key that can create users and arbitrary records, and the key is stored in plaintext in your browser code, what's to keep an enterprising user from using your FaunaDB instance as their own data store if they copy-paste the key into their own scripts?
Does FaunaDB protect against a resource usage attack where the client key is used to (maliciously) create millions or billions of new users, costing $$$$?
The use case we're illustrating here is support for the early stages of experimental apps. In the case of a successful app needing to patch this vulnerability in realtime, the sensible thing to do may be to put the user creation function behind a Lambda-like endpoint or a smart proxy that can apply non-application logic to manage resource attacks.
You can learn about the object-level security model here: https://fauna.com/documentation/security
You shouldn't promote a practice or technique as "secure", but then when asked about security, tell me that the sensible thing to do is to implement security myself.
You should discuss the limitations of your actor-based security model frankly in your documentation and promotional tutorials. Even more so because you plan more security features like "key-based quotas", indicating y'all are well aware of these limitations, and foresee the need for more mitigations!
As it is, I think FaunaDB is an interesting product, but because of the approach to security related messaging, I view the whole system with distrust. What other "lies of omission" would I find if I actually started using this product?
What I would do:
- one-time use token for the creation form, a la CSRF tokens and nonces; Although that just doubles the number of requests needed to perform a submission
- rate-limit all endpoints based on IP, user agent, etc
- Captcha on creation form
Has anything changed other than developer's comfort with connecting directly from the browser to the backend? Mobile apps are common, and single page applications are accepted. In my experience moving to a simpler stack is good for security.
What is the point in having database access with secrets available to the end-user and how is that secure?
Many signup forms don't even have the equivalent of the first secret. It's purpose is more as a client identifier than a genuine secret. If a malicious client were to grab that published secret, the web service author could rotate keys and put a new secret in the HTML, and rate limit the attacked secret.
The "secret" in this case is really being used to select a context. So the secret you'd embed in your copy of the app would differ from mine, and it would point to your database, not mine.
Edit: neat database service as well
Holy shit Kyle, that is a HUGE about face for you!