From 936d78a18df6fb65f167943ccbb6274983706d08 Mon Sep 17 00:00:00 2001 From: Loris S <91723853+loris-s-sonarsource@users.noreply.github.com> Date: Thu, 26 Oct 2023 10:35:54 +0200 Subject: [PATCH] Modify S5547(PL/SQL): Migrate to LayC - code re-creation (#3358) ## Review A dedicated reviewer checked the rule description successfully for: - [ ] logical errors and incorrect information - [ ] information gaps and missing content - [ ] text style and tone - [ ] PR summary and labels follow [the guidelines](https://github.com/SonarSource/rspec/#to-modify-an-existing-rule) --- .../header_names/allowed_framework_names.adoc | 2 ++ .../plsql/how-to-fix-it/dbms-crypto.adoc | 28 +++++++++++++++ rules/S5547/plsql/metadata.json | 3 ++ rules/S5547/plsql/rule.adoc | 36 +++++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 rules/S5547/plsql/how-to-fix-it/dbms-crypto.adoc create mode 100644 rules/S5547/plsql/metadata.json create mode 100644 rules/S5547/plsql/rule.adoc diff --git a/docs/header_names/allowed_framework_names.adoc b/docs/header_names/allowed_framework_names.adoc index e79826464e..6bfc6be4ba 100644 --- a/docs/header_names/allowed_framework_names.adoc +++ b/docs/header_names/allowed_framework_names.adoc @@ -123,5 +123,7 @@ // Azure resource manager * ARM templates * Bicep +// PL/SQL +* DBMS_CRYPTO // Go * Go Standard Library diff --git a/rules/S5547/plsql/how-to-fix-it/dbms-crypto.adoc b/rules/S5547/plsql/how-to-fix-it/dbms-crypto.adoc new file mode 100644 index 0000000000..e3bfd41395 --- /dev/null +++ b/rules/S5547/plsql/how-to-fix-it/dbms-crypto.adoc @@ -0,0 +1,28 @@ +== How to fix it in ``++DBMS_CRYPTO++`` + +=== Code examples + +include::../../common/fix/code-rationale.adoc[] + +==== Noncompliant code example + +[source,sql,diff-id=1,diff-type=noncompliant] +---- +PLS_INTEGER := DBMS_CRYPTO.ENCRYPT_DES // Noncompliant + + DBMS_CRYPTO.CHAIN_CBC + + DBMS_CRYPTO.PAD_PKCS5; +---- + +==== Compliant solution + +[source,sql,diff-id=1,diff-type=compliant] +---- +PLS_INTEGER := DBMS_CRYPTO.ENCRYPT_AES256 + + DBMS_CRYPTO.CHAIN_CBC + + DBMS_CRYPTO.PAD_PKCS5; +---- + +=== How does this work? + +include::../../common/fix/strong-cryptography.adoc[] + diff --git a/rules/S5547/plsql/metadata.json b/rules/S5547/plsql/metadata.json new file mode 100644 index 0000000000..1797133380 --- /dev/null +++ b/rules/S5547/plsql/metadata.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/rules/S5547/plsql/rule.adoc b/rules/S5547/plsql/rule.adoc new file mode 100644 index 0000000000..e42279b0a0 --- /dev/null +++ b/rules/S5547/plsql/rule.adoc @@ -0,0 +1,36 @@ +include::../summary.adoc[] + +== Why is this an issue? + +include::../rationale.adoc[] + +include::../impact.adoc[] + +// How to fix it section + +include::how-to-fix-it/dbms-crypto.adoc[] + +== Resources + +=== Documentation + +* Oracles docs - https://docs.oracle.com/en/database/oracle/oracle-database/21/arpls/DBMS_CRYPTO.html[DBMS_CRYPTO reference] + +include::../common/resources/standards.adoc[] + +ifdef::env-github,rspecator-view[] + +''' +== Implementation Specification +(visible only on this page) + +include::../message.adoc[] + +''' +== Comments And Links +(visible only on this page) + +include::../comments-and-links.adoc[] + +endif::env-github,rspecator-view[] +