3 ms·
I've written about this solution in the context of running LLM-generated SQL safely. I call it the "cloned database view" solution[1]. The author touches on 2
by Supply5411 3y ago
I've written about this solution in the context of running LLM-generated SQL safely. I call it the "cloned database view" solution[1].
The author touches on 2 issues that are tangential to this problem, restricting unauthorized data, and mutations, both of which are not really easily solvable with the cloned database solution.
However, the underlying theme of skipping the API is extremely compelling. So much code, both FE and BE, are just to serve as an elaborate interface to the database. Simplifying this will be a huge gain in software maintenance. But the challenge is to do it safely.
1. https://docs.heimdallm.ai/en/main/blog/posts/safe-sql-execution.html#cloned-db-views https://docs.heimdallm.ai/en/main/blog/posts/safe-sql-execut...
- rmbyrro 3y agoThe pattern here involves database replicas, not clones. It's not for a single-shot test, but for continued use with data synchronization.
- Supply5411 3y agoFrom the post: >A cloned database view is some representation of your database that has been post-processed to only contain data that the user is allowed to see. This representation would typically be in the form of a separate user-specific sqlite database file. Because the cloned database only contains data that is theirs, a user may issue any query against it, and there is no risk to data security. And if a malicious user was able to issue a DDL statement, it would only affect their cloned database. Maybe there is a better word than "cloned database view." Replica doesn't feel quite right though.
- rmbyrro 3y agoI think your use of database clone looks fine in the context you write about. I don't think it applies to the context fly.io is writing about. Your post is about something that seems like a different pattern, I think.