Skip to content

Commit

Permalink
Use filevault-package-maven-plugin 1.4.0
Browse files Browse the repository at this point in the history
Escape attribute values in IT properly
Fix readme regarding attribute escape rules
Fix dependency scopes
  • Loading branch information
kwin committed Oct 1, 2024
1 parent c6e31de commit 1ba5519
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ The master key is looked up from either a Maven property with name `AEM_KEY` (or
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
...
encryptedValue="${vltaemencrypt.env.MY_SECRET}" />
encryptedValue="${vltattributeescape.vltaemencrypt.env.MY_SECRET}" />
```

This will encrypt the value provided through the environment variable `MY_SECRET`.
This will encrypt the value provided through the environment variable `MY_SECRET` and afterwards [escape the encrypted value according to FileVault DocView rules][filevault-escape].

In order to use specific keys (e.g. when targeting multiple environments with different master keys in the same build) use a suffix after `vltaemencrypt` like `vltaemencryptprod.env.MY_SECRET`.
This will encrypt `MY_SECRET` with the master key provided in Maven property with name `AEM_KEY_PROD` or a same named environment variable (in that order). Note that the *suffix* (`prod` in this case) is automatically converted to uppercase letters before being used in the environment variable/property name.
Expand All @@ -96,4 +96,5 @@ the United States and/or other countries.
[aem-cryptosupport]: https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/adobe/granite/crypto/CryptoSupport.html
[groovyconsole]: https://github.com/orbinson/aem-groovy-console
[filevault-package-maven-plugin]: https://jackrabbit.apache.org/filevault-package-maven-plugin/index.html
[filevault-filtering]: https://jackrabbit.apache.org/filevault-package-maven-plugin/filtering.html
[filevault-filtering]: https://jackrabbit.apache.org/filevault-package-maven-plugin/filtering.html#Filtering_Extensions
[filevault-escape]: https://jackrabbit.apache.org/filevault/docview.html#Escaping
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,19 @@
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>filevault-package-maven-plugin</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.0</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
Expand All @@ -94,6 +97,7 @@
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-interpolation</artifactId>
<version>1.21</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -104,6 +108,7 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${version.slf4j}</version>
<scope>test</scope>
</dependency>
</dependencies>

Expand Down Expand Up @@ -254,6 +259,7 @@
<streamLogsOnFailures>true</streamLogsOnFailures>
<postBuildHookScript>verify</postBuildHookScript>
<writeJunitReport>true</writeJunitReport>
<goals>verify</goals>
</configuration>
<executions>
<execution>
Expand Down
4 changes: 2 additions & 2 deletions src/it/simple-filter/jcr_root/apps/foo/.content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
escapedValue="${vltattributeescape.customProperty}"
encryptedValue="${vltaemencrypt.customProperty}"
encryptedValueCustom="${vltaemencryptcustom.customProperty}" />
encryptedValue="${vltattributeescape.vltaemencrypt.customProperty}"
encryptedValueCustom="${vltattributeescape.vltaemencryptcustom.customProperty}" />
2 changes: 1 addition & 1 deletion src/it/simple-filter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<plugin>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>filevault-package-maven-plugin</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<enableJcrRootFiltering>true</enableJcrRootFiltering>
Expand Down
4 changes: 2 additions & 2 deletions src/it/simple-filter/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ try (ZipFile zipFile = new ZipFile(file)) {
try (InputStream input = zipFile.getInputStream(zipEntry)) {
def root = new XmlSlurper().parse(input)
assert(root.@escapedValue == "plainText")
assert(root.@encryptedValue.text() ==~ $/\{[a-z0-9]*\}/$)
assert(root.@encryptedValueCustom.text() ==~ $/\{[a-z0-9]*\}/$)
assert(root.@encryptedValue.text() ==~ $/\\\{[a-z0-9]*\}/$)
assert(root.@encryptedValueCustom.text() ==~ $/\\\{[a-z0-9]*\}/$)
assert(root.@encryptedCustom.text() != root.@encryptedValueCustom.text())
}
}

0 comments on commit 1ba5519

Please sign in to comment.