fix(sql): update sqlx to 0.9 to fix cargo audit (#3815)

* fix(sql): update sqlx to 0.9 to fix cargo audit

cargo audit fails on RUSTSEC-2026-0459: the SQLite bundled by
libsqlite3-sys 0.30 is affected by CVE-2026-119375. Only sqlx 0.9.1
accepts the fixed libsqlite3-sys (>=0.39), and it requires Rust 1.94.

- update sqlx to 0.9.1 and libsqlite3-sys to 0.40. The removed
  runtime-tokio-rustls feature is replaced by runtime-tokio +
  tls-rustls-ring-webpki, which is what it enabled before, and mysql
  now enables mysql-rsa to keep RSA password auth
- wrap frontend-provided queries in AssertSqlSafe (values are still
  bound parameters) and convert migrations with into_sql_str
- bump the workspace MSRV and CI toolchains to 1.94
- ignore RUSTSEC-2026-0387 (crypto-bigint timing), which stronghold
  pulls in through iota-crypto -> k256 0.13 with no fixed release

Tested clippy, tests and doc tests of the sql plugin on Linux with
the sqlite, mysql and postgres features, on 1.94 and stable. Not
tested against real MySQL/Postgres servers or on mobile.

* update change file [skip ci]

* Update .changes/sql-sqlx-0.9.md [skip ci]

Co-authored-by: Fabian-Lars <30730186+FabianLars@users.noreply.github.com>

* update change file [skip ci]

---------

Co-authored-by: Fabian-Lars <30730186+FabianLars@users.noreply.github.com>
This commit is contained in:
Lucas Fernandes NogueiraandFabian-Lars authored and GitHub committed 2026-11-28 06:47:11 -03:00
1 parent 4140767e22
commit a83704743c
40 files changed
+461 -319

No files matched your search

+12 -3
View File
@@ -36,7 +36,12 @@ tauri = { workspace = true }
log = { workspace = true }
thiserror = { workspace = true }
futures-core = "0.3"
sqlx = { version = "0.8", features = ["json", "time", "uuid", "rust_decimal"] }
sqlx = { version = "0.9.1", features = [
"json",
"time",
"uuid",
"rust_decimal",
] }
rust_decimal = "1"
time = "0.3"
tokio = { version = "1", features = ["sync"] }
@@ -45,6 +50,10 @@ uuid = "1"
[features]
sqlite = ["sqlx/sqlite", "sqlx/runtime-tokio"]
mysql = ["sqlx/mysql", "sqlx/runtime-tokio-rustls"]
postgres = ["sqlx/postgres", "sqlx/runtime-tokio-rustls"]
mysql = ["sqlx/mysql-rsa", "sqlx/runtime-tokio", "sqlx/tls-rustls-ring-webpki"]
postgres = [
"sqlx/postgres",
"sqlx/runtime-tokio",
"sqlx/tls-rustls-ring-webpki",
]
# TODO: bundled-cipher etc
+1 -1
View File
@@ -12,7 +12,7 @@ Interface with SQL databases through [sqlx](https://github.com/launchbadge/sqlx)
## Install
_This plugin requires a Rust version of at least **1.90**_
_This plugin requires a Rust version of at least **1.94**_
There are three general methods of installation that we can recommend.
+2 -1
View File
@@ -29,6 +29,7 @@ pub use wrapper::DbPool;
use futures_core::future::BoxFuture;
use serde::{Deserialize, Serialize};
use sqlx::{
SqlSafeStr,
error::BoxDynError,
migrate::{Migration as SqlxMigration, MigrationSource, MigrationType, Migrator},
};
@@ -125,7 +126,7 @@ impl MigrationSource<'static> for MigrationList {
migration.version,
migration.description.into(),
migration.kind.into(),
migration.sql.into(),
migration.sql.into_sql_str(),
false,
));
}
+6 -6
View File
@@ -160,7 +160,7 @@ impl DbPool {
Ok(match self {
#[cfg(feature = "sqlite")]
DbPool::Sqlite(pool) => {
let mut query = sqlx::query(&_query);
let mut query = sqlx::query(sqlx::AssertSqlSafe(_query));
for value in _values {
if value.is_null() {
query = query.bind(None::<JsonValue>);
@@ -180,7 +180,7 @@ impl DbPool {
}
#[cfg(feature = "mysql")]
DbPool::MySql(pool) => {
let mut query = sqlx::query(&_query);
let mut query = sqlx::query(sqlx::AssertSqlSafe(_query));
for value in _values {
if value.is_null() {
query = query.bind(None::<JsonValue>);
@@ -200,7 +200,7 @@ impl DbPool {
}
#[cfg(feature = "postgres")]
DbPool::Postgres(pool) => {
let mut query = sqlx::query(&_query);
let mut query = sqlx::query(sqlx::AssertSqlSafe(_query));
for value in _values {
if value.is_null() {
query = query.bind(None::<JsonValue>);
@@ -228,7 +228,7 @@ impl DbPool {
Ok(match self {
#[cfg(feature = "sqlite")]
DbPool::Sqlite(pool) => {
let mut query = sqlx::query(&_query);
let mut query = sqlx::query(sqlx::AssertSqlSafe(_query));
for value in _values {
if value.is_null() {
query = query.bind(None::<JsonValue>);
@@ -258,7 +258,7 @@ impl DbPool {
}
#[cfg(feature = "mysql")]
DbPool::MySql(pool) => {
let mut query = sqlx::query(&_query);
let mut query = sqlx::query(sqlx::AssertSqlSafe(_query));
for value in _values {
if value.is_null() {
query = query.bind(None::<JsonValue>);
@@ -288,7 +288,7 @@ impl DbPool {
}
#[cfg(feature = "postgres")]
DbPool::Postgres(pool) => {
let mut query = sqlx::query(&_query);
let mut query = sqlx::query(sqlx::AssertSqlSafe(_query));
for value in _values {
if value.is_null() {
query = query.bind(None::<JsonValue>);