From 9d89967412d94ca092ebb90ed1ef39a7844f9029 Mon Sep 17 00:00:00 2001 From: Mark Brophy <36955467+m-brophy@users.noreply.github.com> Date: Tue, 5 Sep 2023 16:21:45 +0100 Subject: [PATCH] WINDUPRULE-1018: new ruleset for eap8 log4j removed (#1016) * WINDUPRULE-1018: new ruleset for eap8 log4j removed * fix typo and logic error in rule 00001 * alter ruleset description --------- Co-authored-by: PhilipCattanach <31246010+PhilipCattanach@users.noreply.github.com> (cherry picked from commit 4c2e12d3db58822f67311dc85681ddf198775fa1) --- .../eap8/eap7/log4j-removed.windup.xml | 147 ++++++++++++++++++ .../data/log4j-removed-no-config/Test.java | 8 + .../log4j-removed-with-config/Manifest.MF | 1 + .../data/log4j-removed-with-config/Test.java | 8 + .../jboss-deployment-structure.xml | 7 + .../log4j-removed-with-config/jboss-log4j.xml | 0 .../log4j.properties | 0 .../data/log4j-removed-with-config/log4j.xml | 0 .../log4j-removed-with-config/standalone.xml | 19 +++ .../log4j-removed-no-config.windup.test.xml | 24 +++ .../eap7/tests/log4j-removed.windup.test.xml | 60 +++++++ 11 files changed, 274 insertions(+) create mode 100644 rules/rules-reviewed/eap8/eap7/log4j-removed.windup.xml create mode 100644 rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-no-config/Test.java create mode 100644 rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/Manifest.MF create mode 100644 rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/Test.java create mode 100644 rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/jboss-deployment-structure.xml create mode 100644 rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/jboss-log4j.xml create mode 100644 rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/log4j.properties create mode 100644 rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/log4j.xml create mode 100644 rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/standalone.xml create mode 100644 rules/rules-reviewed/eap8/eap7/tests/log4j-removed-no-config.windup.test.xml create mode 100644 rules/rules-reviewed/eap8/eap7/tests/log4j-removed.windup.test.xml diff --git a/rules/rules-reviewed/eap8/eap7/log4j-removed.windup.xml b/rules/rules-reviewed/eap8/eap7/log4j-removed.windup.xml new file mode 100644 index 000000000..4ff58f3f3 --- /dev/null +++ b/rules/rules-reviewed/eap8/eap7/log4j-removed.windup.xml @@ -0,0 +1,147 @@ + + + + + This ruleset provides analysis of Java EE applications that use log4j which is no longer bundled within EAP8 + + + + + + + + + + + + + + + + IMPORT + + + + + + + + + + + + + + + + + + + + + + Log4j usage without configuration files + + + + + + + + + + + + + + + + + + IMPORT + + + + + + Log4j usage without including `log4j.jar` + + + + + + + + + + + + + + + + + + + + + + Log4j configuration without including `log4j.jar` + + + + + + + + + + + + + + + + + + + + + + + + + Log4j custom-handler using appender + + + + + + + + + + + + + + + + + + + + + + + + + Log4j module dependency declaration + + + + + + \ No newline at end of file diff --git a/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-no-config/Test.java b/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-no-config/Test.java new file mode 100644 index 000000000..426ee93da --- /dev/null +++ b/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-no-config/Test.java @@ -0,0 +1,8 @@ +import org.apache.log4j.Logger; + +public class Test { + + public static void main(String[] args) { + Logger logger = new Logger(); + } +} \ No newline at end of file diff --git a/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/Manifest.MF b/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/Manifest.MF new file mode 100644 index 000000000..2a20c1c6b --- /dev/null +++ b/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/Manifest.MF @@ -0,0 +1 @@ +Dependencies: org.jboss.log4j.logmanager \ No newline at end of file diff --git a/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/Test.java b/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/Test.java new file mode 100644 index 000000000..426ee93da --- /dev/null +++ b/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/Test.java @@ -0,0 +1,8 @@ +import org.apache.log4j.Logger; + +public class Test { + + public static void main(String[] args) { + Logger logger = new Logger(); + } +} \ No newline at end of file diff --git a/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/jboss-deployment-structure.xml b/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/jboss-deployment-structure.xml new file mode 100644 index 000000000..12ecbd78b --- /dev/null +++ b/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/jboss-deployment-structure.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/jboss-log4j.xml b/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/jboss-log4j.xml new file mode 100644 index 000000000..e69de29bb diff --git a/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/log4j.properties b/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/log4j.properties new file mode 100644 index 000000000..e69de29bb diff --git a/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/log4j.xml b/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/log4j.xml new file mode 100644 index 000000000..e69de29bb diff --git a/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/standalone.xml b/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/standalone.xml new file mode 100644 index 000000000..f6a7bc7f1 --- /dev/null +++ b/rules/rules-reviewed/eap8/eap7/tests/data/log4j-removed-with-config/standalone.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rules/rules-reviewed/eap8/eap7/tests/log4j-removed-no-config.windup.test.xml b/rules/rules-reviewed/eap8/eap7/tests/log4j-removed-no-config.windup.test.xml new file mode 100644 index 000000000..ea8dd4ada --- /dev/null +++ b/rules/rules-reviewed/eap8/eap7/tests/log4j-removed-no-config.windup.test.xml @@ -0,0 +1,24 @@ + + + data/log4j-removed-no-config/ + ../log4j-removed.windup.xml + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rules/rules-reviewed/eap8/eap7/tests/log4j-removed.windup.test.xml b/rules/rules-reviewed/eap8/eap7/tests/log4j-removed.windup.test.xml new file mode 100644 index 000000000..d35a0350c --- /dev/null +++ b/rules/rules-reviewed/eap8/eap7/tests/log4j-removed.windup.test.xml @@ -0,0 +1,60 @@ + + + data/log4j-removed-with-config/ + ../log4j-removed.windup.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file