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

S610: false positive on unrelated method named extra #12463

Open
nelsyeung opened this issue Jul 22, 2024 · 2 comments
Open

S610: false positive on unrelated method named extra #12463

nelsyeung opened this issue Jul 22, 2024 · 2 comments
Labels
type-inference Requires more advanced type inference.

Comments

@nelsyeung
Copy link

main.py:

class A:
    def extra(self, foo): ...


A().extra(1)
> ruff --version
ruff 0.5.4

> ruff check main.py
main.py:5:10: S610 Use of Django `extra` can lead to SQL injection vulnerabilities
  |
5 | A().extra(1)
  |          ^^^ S610

See #1646 and #10316

@nelsyeung nelsyeung changed the title S610: false positive on method named extra S610: false positive on unrelated method named extra Jul 22, 2024
@MichaReiser MichaReiser added the type-inference Requires more advanced type inference. label Jul 23, 2024
@MichaReiser
Copy link
Member

Thanks for reporting. Unfortunately, this is hard for ruff to get right at the moment without having type inference. But we're working on it.

@AlexWaygood
Copy link
Member

I agree with @MichaReiser. I'd also note that erring on the side of false positives is probably the correct tradeoff when it comes to a security-related rule. I think you'd much rather have something be incorrectly flagged as a security issue than have some dangerous code accidentally slip through the net.

If you don't use django at all in your project, and the rule is causing false positives for you, I'd consider just switching the rule off for now in your Ruff configuration file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-inference Requires more advanced type inference.
Projects
None yet
Development

No branches or pull requests

3 participants