Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
35e7ca5
fix(storage-sqlite): create the database file with mode 0600 before S…
LeeroyHannigan Oct 30, 2026
39f70de
test(storage-sqlite): check the modes of the database and WAL files a…
LeeroyHannigan Oct 30, 2026
ab45c21
fix(storage-sqlite): open every SQLite file pool through one owner-on…
LeeroyHannigan Oct 30, 2026
c23b8bf
test(storage-sqlite): check the restrict after connect and the locati…
LeeroyHannigan Oct 30, 2026
5b075d4
test(storage-sqlite): check prepare and restrict on a sqlite: URL loc…
LeeroyHannigan Oct 30, 2026
bc497d1
test(storage-sqlite): move the file_mode unit tests into their own file
LeeroyHannigan Oct 30, 2026
4dca12f
fix(storage-sqlite): narrow only regular files wider than 0600, throu…
LeeroyHannigan Oct 30, 2026
561f6f5
test(storage-sqlite): check that narrowing a database's files keeps t…
LeeroyHannigan Oct 30, 2026
967693e
test(storage-sqlite): check each opener alone and the mode the databa…
LeeroyHannigan Oct 30, 2026
8c88ed6
fix(storage-sqlite): read SQLite locations the way sqlx and SQLite re…
LeeroyHannigan Oct 30, 2026
d65be1f
docs: describe the modes set on SQLite database files and the error w…
LeeroyHannigan Oct 31, 2026
8bc4fea
fix(storage-sqlite): compile the URI access flags only on Unix
LeeroyHannigan Oct 31, 2026
51c2f1f
docs: name every cause of the SQLite file mode errors
LeeroyHannigan Oct 31, 2026
0e9a6ed
Merge origin/main into fix/657-sqlite-file-modes
LeeroyHannigan Nov 5, 2026
dea54d3
Merge origin/main into fix/657-sqlite-file-modes
LeeroyHannigan Nov 14, 2026
eb7ecae
docs(storage-sqlite): name the engine pool's own connect in the file_…
LeeroyHannigan Nov 14, 2026
129bd61
docs(sqlite): name the pools that open through file_mode::connect
LeeroyHannigan Nov 14, 2026
579f0bc
Merge origin/main into fix/657-sqlite-file-modes
LeeroyHannigan Nov 18, 2026
efb64f3
docs(troubleshooting): state the SQLite file mode cause for both key …
LeeroyHannigan Nov 18, 2026
8c59d1e
fix(sqlite): check each owner-only call of the engine pool and the mi…
LeeroyHannigan Nov 20, 2026
0c70aff
fix(sqlite): create the migration runner's database through a danglin…
LeeroyHannigan Nov 20, 2026
5840015
test(sqlite): read the migration runner's sidecar modes while it open…
LeeroyHannigan Nov 20, 2026
11867db
Merge origin/main into fix/657-sqlite-file-modes
LeeroyHannigan Nov 24, 2026
85c2424
test(sqlite): remove each file mode test directory when the test fails
LeeroyHannigan Nov 24, 2026
eb3a582
fix(sqlite): drop the narrowing after connect, which changed no mode
LeeroyHannigan Nov 24, 2026
d891fb0
fix(sqlite): give prepare, the runner and init one database file creator
LeeroyHannigan Nov 24, 2026
0ed0709
test(sqlite): check the new file's fchmod and both mode error messages
LeeroyHannigan Nov 24, 2026
850d7e8
fix(sqlite): create a database file only for a unix VFS SQLite has
LeeroyHannigan Nov 24, 2026
6debd68
docs(sqlite): correct two comments on symlinks and the store opener
LeeroyHannigan Nov 24, 2026
bb179bf
docs: name every command that sets the SQLite file modes, and add the…
LeeroyHannigan Nov 24, 2026
46c2d36
test(sqlite): pass the test directory's path without a second borrow
LeeroyHannigan Nov 24, 2026
f6870f4
Merge origin/main into fix/657-sqlite-file-modes
LeeroyHannigan Nov 24, 2026
46fd13e
build(sqlite): read the location query with form_urlencoded, not url
LeeroyHannigan Nov 24, 2026
79febe7
Merge origin/main into fix/657-sqlite-file-modes
LeeroyHannigan Nov 25, 2026
29ba451
test(sqlite): check that prepare narrows a database behind a symlink
LeeroyHannigan Nov 25, 2026
e85d869
Merge origin/main into fix/657-sqlite-file-modes
LeeroyHannigan Dec 3, 2026
141cbd0
docs(upgrade): move the SQLite file modes to the v1.2.0 changes
LeeroyHannigan Dec 3, 2026
8369db4
Merge origin/main into fix/657-sqlite-file-modes
LeeroyHannigan Dec 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions crates/storage-sqlite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ bigdecimal = { workspace = true }
crc32fast = { workspace = true }
zeroize = { workspace = true }
web-time = { workspace = true }
# `database_file` reads a location's query as sqlx reads it, on both targets.
# The crate `url` re-exports; `url` itself would add its IDNA tables to the
# wasm32 build.
form_urlencoded = "1"

# Storage transport, split per target. Native keeps `sqlx` (SQLite feature) and
# the C `libsqlite3-sys`; native SQLite is the behaviour this backend is
Expand Down Expand Up @@ -109,6 +113,8 @@ extenddb-backup-store = { path = "../backup-store" }
# every tracing event of a child process.
log = "0.4"
tracing-subscriber = { workspace = true }
# Scratch directories that are removed when a test panics.
tempfile = "3"
# The crate's own tests need `test-hooks`; a dev-dependency on itself turns
# the feature on for test builds only.
extenddb-storage-sqlite = { path = ".", features = ["test-hooks"] }
18 changes: 6 additions & 12 deletions crates/storage-sqlite/src/bootstrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ impl SqliteBootstrapper {
))
})?;
}
SqlitePoolOptions::new()
let options = SqlitePoolOptions::new()
.max_connections(1)
.after_connect(|conn, _| {
Box::pin(
async move { crate::sqlite_util::set_connection_pragmas(conn, true).await },
)
})
.connect(&sqlite_url(&self.path))
});
crate::file_mode::connect(&self.path, options)
.await
.map_err(|e| OpError::Internal(format!("open SQLite database '{}': {e}", self.path)))
}
Expand Down Expand Up @@ -158,15 +158,9 @@ impl Bootstrapper for SqliteBootstrapper {
))
})?;
}
let mut options = std::fs::OpenOptions::new();
options.write(true).create_new(true);
#[cfg(unix)]
{
use std::os::unix::fs::OpenOptionsExt;
options.mode(0o600);
}
match options.open(path) {
Ok(_) => Ok(()),
let created = crate::file_mode::create_owner_only(path).map_err(OpError::Internal)?;
match created {
Ok(()) => Ok(()),
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => Err(exists()),
Err(e) => Err(OpError::Internal(format!(
"create SQLite database '{}': {e}",
Expand Down
Loading
Loading