-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds support for rejecting `ATTACH` statements from dumps. `ATTACH` statements should be considered dangerous in a multi-tenant setting. With this commit any `ATTACH` statement inside a dump will be rejected with a 400 status code and a message. In addition, any other sql errors returned by sqlite will be returned as a 400. All other dump errors through this code path (conn.with_raw) will return a 500 like before.
- Loading branch information
1 parent
a77f422
commit 3c62bd7
Showing
4 changed files
with
109 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
.../tests/namespaces/snapshots/tests__namespaces__dumps__load_dump_with_attach_rejected.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
source: libsql-server/tests/namespaces/dumps.rs | ||
expression: resp.body_string().await? | ||
snapshot_kind: text | ||
--- | ||
{"error":"The passed dump sql is invalid: attach statements are not allowed in dumps, msg: near \"COMMIT\": syntax error, sql: ATTACH foo/bar.sql\n COMMIT;, offset: 28"} |