
* Add check for security standard mismatch * Fix security standard mismatches * Fix Resources/Standards links for secrets rules * Fix check * Fix links and update security standard mapping * Fix maintanability issue * Apply review suggestions * Apply suggestions from code review Co-authored-by: Egon Okerman <egon.okerman@sonarsource.com> * Fix typo Co-authored-by: Egon Okerman <egon.okerman@sonarsource.com> --------- Co-authored-by: Egon Okerman <egon.okerman@sonarsource.com>
46 lines
1.1 KiB
Plaintext
46 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
``++PreparedStatement++``s and ``++CallableStatement++``s (for stored procedures) are safer and more efficient than ``++Statement++``s and should always be preferred.
|
|
|
|
|
|
This rule raises an issue each time a ``++Statement++`` is declared.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,java]
|
|
----
|
|
Statement stmt = null; // Noncompliant
|
|
// ...
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,java]
|
|
----
|
|
PreparedStatement stmt = null;
|
|
// ...
|
|
----
|
|
|
|
|
|
== Resources
|
|
|
|
* OWASP - https://owasp.org/Top10/A05_2021-Security_Misconfiguration/[Top 10 2021 Category A5 - Security Misconfiguration]
|
|
* CWE - https://cwe.mitre.org/data/definitions/20[CWE-20 - Improper Input Validation]
|
|
* CWE - https://cwe.mitre.org/data/definitions/89[CWE-89 - Improper Neutralization of Special Elements used in an SQL Command]
|
|
* OWASP - https://owasp.org/www-project-top-ten/2017/A1_2017-Injection[OWASP Top 10 2017 Category A1 - Injection]
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== duplicates: S2077
|
|
|
|
=== on 1 Dec 2015, 11:14:50 Michael Gumowski wrote:
|
|
LGTM!
|
|
|
|
endif::env-github,rspecator-view[]
|