Skip to content

Query API with raw string is dangerously designed #589

@Joannis

Description

@Joannis

Right now, the query function has two overloads. One for PostgresQuery, which handles parameter binding in interpolation. The other one accepts a raw string. Because the PostgresQuery uses a great transparent designs, those not extremely intimately familiar with Swift may be tricked into believing any String is safe.

This is amplified by the fact you can pass String into the query APIs the same way you can a PostgresQuery. Thus leads many users to use the wrong API, leaving them vulnerable to SQL injection.

I'd recommend deprecating the query aPI for string, and if strictly necessary reintroducing it while marking it explicitly unsafe/unchecked in the public signature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions