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

False positive for S608 when a string contains "delete from" #13103

Open
dhruvmanila opened this issue Aug 26, 2024 · 1 comment
Open

False positive for S608 when a string contains "delete from" #13103

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

Comments

@dhruvmanila
Copy link
Member

i have this problem :(

S608 Possible SQL injection vector through string-based query construction

logger.warning(f'The linked role <{1}> has been delete from the guild {2}')

Originally posted by @Arexils in #8723 (comment)

@dhruvmanila dhruvmanila added the bug Something isn't working label Aug 26, 2024
@dhruvmanila
Copy link
Member Author

I think this is because the string contains "delete from" in the middle. The regex isn't anchored to the start:

static SQL_REGEX: Lazy<Regex> = Lazy::new(|| {
Regex::new(r"(?i)\b(select\s.+\sfrom\s|delete\s+from\s|(insert|replace)\s.+\svalues\s|update\s.+\sset\s)")
.unwrap()
});

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

1 participant