Skip to content

SQLite URLs with a user, password or port are accepted and silently misread #997

Closed

Description

@AndreaBozzo

The problem

A SQLite URL that carries a user, password, host or port is accepted without an error, and the extra parts are either dropped or read as part of the file name. SQLite has no network endpoint and no credentials, so these URLs are always a mistake: a copied PostgreSQL URL with the scheme changed, or a typo.

On master, sqlite://user:pw@host:5432/data.db goes through ConnectionInfo::parse (crates/dataprof-db/src/connection.rs), which keeps only database = "data.db", and SqliteConnector::connect rebuilds sqlite://data.db. The profiler opens data.db relative to the working directory, or profiles whatever file sits there, and the user, host and port vanish without a word.

Once #990 lands, connect passes a sqlite: URL to sqlx unchanged. sqlx strips the scheme and uses the rest as the file name, so the same URL asks SQLite for a file literally named user:pw@host:5432/data.db. That fails to open, but the error is about a missing file, not about the URL form.

What you'd like

  • SqliteConnector::new rejects a SQLite URL with a user, password or port with DatabaseConfigError, naming what it found (not the password) and the supported forms: sqlite:///absolute/path.db, sqlite://relative/path.db, sqlite::memory:, or a bare file path.
  • A unit test per rejected part, and one showing the supported forms still construct a connector.

A host on its own is not an error: in sqlite://relative/path.db the first segment parses as a host.

Where to start

SqliteConnector::new in crates/dataprof-db/src/connectors/sqlite.rs already has the parsed ConnectionInfo. The closed #897 had a version of this check:

if connection_info.scheme == "sqlite"
    && (connection_info.username.is_some()
        || connection_info.password.is_some()
        || connection_info.port.is_some())
{
    return Err(DataProfilerError::DatabaseConfigError {
        message: "SQLite URLs do not support credentials or ports".to_string(),
    });
}

Review on #897 asked for the message to name the rejected form and a supported example. Test with cargo test -p dataprof-db --features sqlite.

Activity

  1. added this to the 0.13.0 milestone on Oct 19, 2026
  2. added 2 commits that reference this issue on Oct 19, 2026
    c12ff88
    0aac8de
  3. added a commit that references this issue on Oct 21, 2026
    ed49293
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: databaseDatabase connectors and SQLbugSomething isn't workingdifficulty: beginnerPerfect for first-time contributorsgood first issueGood for newcomershelp wantedExtra attention is needed

    Projects

    • Status
      Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions