sqlite-inproc: Add allow_attach_file runtime config option#3503
Open
lann wants to merge 1 commit into
Open
Conversation
lann
commented
May 11, 2026
| let line = line!(); | ||
| return Err(format!( | ||
| "{krate}#({file}:{line}) {}", format_args!($fmt, $($arg)*) | ||
| "{krate}#({file}:{line}) {}", format_args!($fmt $(, $($arg)*)?) |
Collaborator
Author
There was a problem hiding this comment.
This drive-by refactor makes the trailing comma optional when no extra args are passed, e.g. https://github.com/spinframework/spin/pull/3503/changes#diff-980855598b2b312f034dcd583093cd525c7d808c00097b4e62424c35a801d89eL56-R56
lann
commented
May 11, 2026
| for forbidden_stmt in ["ATTACH 'any_file' AS attach_file", "VACUUM INTO 'any_file'"] { | ||
| match conn.execute(forbidden_stmt, &[]) { | ||
| Ok(_) => bail!("{forbidden_stmt:?} should fail"), | ||
| Err(Error::Io(s)) if s.contains("authoriz") => {} |
Collaborator
Author
There was a problem hiding this comment.
Annoyingly the ATTACH and VACUUM errors are sliiiightly different, leading to this awkward check.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This option defaults to false, blocking the sqlite
ATTACHstatement from being used with regular files, which could be used to open other sqlite databases.