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] "S608 Possible SQL injection" when not applicable #8717

Open
amotl opened this issue Nov 16, 2023 · 1 comment
Open

[FALSE POSITIVE] "S608 Possible SQL injection" when not applicable #8717

amotl opened this issue Nov 16, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@amotl
Copy link

amotl commented Nov 16, 2023

Hi there,

thank you for your continued efforts in conceiving Ruff.

While working on crate/cratedb-toolkit#81, we just observed a funny case of S608 Possible SQL injection vector through string-based query construction we would like to share with you. It is easy to reproduce using the most recent ruff 0.1.5.

variants = ["foo", "bar"]
raise ValueError(f"Please select a value from the list of possible variants: {variants}.")

It looks like S608 is tripping because the f-string includes the keywords select and from. If you remove any of it, it will not trip. I don't know if there will be any solution for this worth to follow up on. It is easy for me to slap a # noqa: S608 into the code, so you may want to close this issue right away.

With kind regards,
Andreas.

@zanieb zanieb added the bug Something isn't working label Nov 16, 2023
@zanieb
Copy link
Member

zanieb commented Nov 16, 2023

Thanks for the report!

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

Successfully merging a pull request may close this issue.

2 participants