-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WINDUPRULE-901] Add ruleset for legacy vault removal (#858)
* [WINDUPRULE-901] Add ruleset for legacy vault removal * [WINDUPRULE-901] Fix test paths * [WINDUPRULE-901] Fix filecontent pattern * [WINDUPRULE-901] Fix test id * [WINDUPRULE-901] Escape characters * [WINDUPRULE-901] Rewrite rules --------- Co-authored-by: Carlos E. Feria Vila <carlosthe19916@gmail.com>
- Loading branch information
1 parent
3bbf0be
commit f1d18ca
Showing
4 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0"?> | ||
<ruleset xmlns="http://windup.jboss.org/schema/jboss-ruleset" id="legacy-vault" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://windup.jboss.org/schema/jboss-ruleset http://windup.jboss.org/schema/jboss-ruleset/windup-jboss-ruleset.xsd"> | ||
<metadata> | ||
<description> | ||
This ruleset provides analysis of Java EE applications that need to remove their legacy vault configuration. | ||
</description> | ||
<dependencies> | ||
<addon id="org.jboss.windup.rules,windup-rules-javaee,3.0.0.Final"/> | ||
<addon id="org.jboss.windup.rules,windup-rules-java,3.0.0.Final"/> | ||
</dependencies> | ||
<targetTechnology id="eap" versionRange="[8,9)"/> | ||
</metadata> | ||
<rules> | ||
<rule id="legacy-vault-00010"> | ||
<when> | ||
<!-- TODO: try to fix javaclass condition --> | ||
<filecontent pattern="$\{VAULT::" filename="{*}.{filetype}"/> | ||
<!-- | ||
<javaclass references="org.x.Annotation"> | ||
<location>ANNOTATION</location> | ||
<annotation-literal name="not-used" pattern="$\{VAULT::{*}"/> | ||
</javaclass> | ||
--> | ||
</when> | ||
<perform> | ||
<hint title="Legacy Vault configuration must be removed" effort="1" category-id="mandatory"> | ||
<message> | ||
Vault support has been removed in EAP8; migration to Elytron credential store is mandatory. | ||
</message> | ||
<!-- TODO: add migration guide link when is available --> | ||
</hint> | ||
</perform> | ||
<where param="filetype"> | ||
<matches pattern="(xml|java)"/> | ||
</where> | ||
</rule> | ||
</rules> | ||
</ruleset> |
9 changes: 9 additions & 0 deletions
9
rules/rules-reviewed/eap8/eap7/tests/data/legacy-vault/LegacyVault.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import org.x.Annotation; | ||
|
||
public class LegacyVault { | ||
|
||
@Annotation(value="${VAULT::someInfo}") | ||
public String aMethod() { | ||
return "Hello World!"; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
rules/rules-reviewed/eap8/eap7/tests/data/legacy-vault/jboss-app.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="ISO-8859-1"?> | ||
<!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 4.2//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_4_2.dtd"> | ||
<jboss-app> | ||
<security-domain>${VAULT::...}</security-domain> | ||
<security-role> | ||
<role-name>Administrator</role-name> | ||
<principal-name>j2ee</principal-name> | ||
</security-role> | ||
<security-role> | ||
<role-name>Manager</role-name> | ||
<principal-name>javajoe</principal-name> | ||
</security-role> | ||
<security-role> | ||
<role-name>Employee</role-name> | ||
<principal-name>javajoe</principal-name> | ||
<principal-name>j2ee</principal-name> | ||
</security-role> | ||
</jboss-app> |
24 changes: 24 additions & 0 deletions
24
rules/rules-reviewed/eap8/eap7/tests/legacy-vault.windup.test.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0"?> | ||
<ruletest id="legacy-vault-tests" | ||
xmlns="http://windup.jboss.org/schema/jboss-ruleset" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://windup.jboss.org/schema/jboss-ruleset http://windup.jboss.org/schema/jboss-ruleset/windup-jboss-ruleset.xsd"> | ||
<testDataPath>data/legacy-vault</testDataPath> | ||
<rulePath>../legacy-vault.windup.xml</rulePath> | ||
<ruleset> | ||
<rules> | ||
<rule id="legacy-vault-00010-test"> | ||
<when> | ||
<not> | ||
<iterable-filter size="2"> | ||
<hint-exists message="Vault support has been removed in EAP8; migration to Elytron credential store is mandatory."/> | ||
</iterable-filter> | ||
</not> | ||
</when> | ||
<perform> | ||
<fail message="[legacy-vault-00010] The hint was not found!" /> | ||
</perform> | ||
</rule> | ||
</rules> | ||
</ruleset> | ||
</ruletest> |