Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent SQL Injection #186

Open
chaseWillden opened this issue Oct 26, 2024 · 1 comment
Open

Prevent SQL Injection #186

chaseWillden opened this issue Oct 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@chaseWillden
Copy link
Collaborator

Currently we are doing the format! function to create the SQL statements, this technically would allow for easy SQL injection attacks. This is to provide sanitization of the SQL before execution

@chaseWillden chaseWillden added the bug Something isn't working label Oct 26, 2024
@mjovanc
Copy link
Member

mjovanc commented Nov 5, 2024

You mean doing something like this below?

fn sanitize_input(input: &str) -> String {
    input
        .replace('\'', "''") // Escape single quotes
        .replace('\\', "\\\\") // Escape backslashes
        .replace('%', "\\%") // Escape LIKE wildcards
        .replace('_', "\\_") // Escape LIKE wildcards
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants