Skip to content

Conversation

@hansott
Copy link
Member

@hansott hansott commented Jan 6, 2025

With a partial match

@kapyteinaikido kapyteinaikido self-requested a review January 6, 2025 17:47
#[test]
fn test_partial_match_single_quote() {
let starts_with = r#"
SELECT "foo" WHERE "bar" = '''; sleep 15 ;"'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add is injection cases

// However, if the user input is `'value` and the single quote is escaped with another single quote
// `'value` becomes `'''value'` in the query so we still find an exact match
// (vice versa for double quotes)
if userinput.contains("'") || userinput.contains('"') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

starts_with?

The start of the string, the double quote to escape the next double
quote, the actual double quote of the user input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants