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

[EC72] suggested compliant solution is vulnerable to injection #351

Open
hwestra opened this issue Aug 28, 2024 · 0 comments
Open

[EC72] suggested compliant solution is vulnerable to injection #351

hwestra opened this issue Aug 28, 2024 · 0 comments

Comments

@hwestra
Copy link

hwestra commented Aug 28, 2024

Describe the bug
'Compliant Solution' in the asciidoc of EC72 "Avoid SQL request in loop" suggests using String concatenation of user-supplied values and createStatement for building & executing a SQL query. Both are discouraged, as they are frequent sources of injection vulnerabilities. (Also, the code would not compile - baseQuery and query variables are mixed up.) This lowers acceptance & credibility of the ecoCode rules.

Expected behavior
Provide a 'Compliant Solution' that compiles and promotes secure coding practices.
See e.g. https://www.baeldung.com/java-jdbc-preparedstatement-in-clause section 3.2, "IN Clause With Stream".
(Section 3.3 uses functionality that most SQL connectors don't implement.)

Reference
ecocode-rules-specifications/src/main/rules/EC72/java/EC72.asciidoc

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

No branches or pull requests

1 participant