The database key is in the browser
4.1The master key to the whole database is sitting in the web page, where any visitor can copy it.
With that key, anyone reads and changes every client's invoices and files directly, not just their own. The login in front of it stops nothing.
Keep the full-rights key on the server; give the browser a key scoped to the logged-in client, or no key at all.
4.1 Someone Else's Files →