@@ -3,6 +3,10 @@ bootRun {
33 enabled = false
44}
55dependencies {
6+ // Security-hardening utilities (zip-slip, SSRF, filename sanitization, command injection).
7+ // Declared as api here so core + proprietary (which depend on common) get it transitively,
8+ // keeping it off modules that don't need it (e.g. saas).
9+ api ' io.github.pixee:java-security-toolkit:1.2.3'
610 api " com.google.guava:guava:${ guavaVersion} "
711 api ' org.springframework.boot:spring-boot-starter-webmvc'
812 api ' org.springframework.boot:spring-boot-starter-aspectj'
@@ -22,7 +26,10 @@ dependencies {
2226 api " org.springdoc:springdoc-openapi-starter-webmvc-ui:3.0.3"
2327 // Simple Java Mail for EML/MSG parsing (replaces direct Angus Mail usage)
2428 api ' org.simplejavamail:simple-java-mail:9.3.2'
25- api ' org.simplejavamail:outlook-module:9.3.2' // MSG file support
29+ // MSG file support; exclude commons-math3 (only HSSF/formula needs it, MSG parsing doesn't)
30+ api(' org.simplejavamail:outlook-module:9.3.2' ) {
31+ exclude group : ' org.apache.commons' , module : ' commons-math3'
32+ }
2633 api ' jakarta.mail:jakarta.mail-api:2.1.5'
2734 runtimeOnly ' org.eclipse.angus:angus-mail:2.0.5'
2835
@@ -36,12 +43,30 @@ dependencies {
3643
3744 api " com.stirling:jpdfium:${ jpdfiumVersion} "
3845
39- // -PjpdfiumPlatforms=all|none|<csv of linux-x64,linux-arm64,darwin-x64,darwin-arm64,windows-x64>
40- // 'none' skips natives entirely (windows-arm64 builds, until JPDFium ships that platform).
41- def jpdfiumPlatformsProp = (project. findProperty(' jpdfiumPlatforms' ) ?: ' all' ). toString(). trim()
42- def jpdfiumAllPlatforms = [' linux-x64' , ' linux-arm64' , ' darwin-x64' , ' darwin-arm64' , ' windows-x64' ]
46+ // -PjpdfiumPlatforms=auto|all|none|<csv of linux-x64,linux-arm64,linux-musl-x64,linux-musl-arm64,darwin-x64,darwin-arm64,windows-x64> (windows-arm64 natives not published yet)
47+ def jpdfiumPlatformsProp = (project. findProperty(' jpdfiumPlatforms' ) ?: ' auto' ). toString(). trim()
48+ def jpdfiumAllPlatforms = [' linux-x64' , ' linux-arm64' , ' linux-musl-x64' , ' linux-musl-arm64' , ' darwin-x64' , ' darwin-arm64' , ' windows-x64' ]
4349 def jpdfiumPlatforms
44- if (jpdfiumPlatformsProp == ' all' ) {
50+ if (jpdfiumPlatformsProp == ' auto' ) {
51+ def osName = System . getProperty(' os.name' ). toLowerCase()
52+ def osArch = System . getProperty(' os.arch' ). toLowerCase()
53+ def isArm64 = osArch. contains(' aarch64' ) || osArch. contains(' arm64' )
54+ if (osName. contains(' linux' )) {
55+ jpdfiumPlatforms = isArm64 ? [' linux-arm64' ] : [' linux-x64' ]
56+ } else if (osName. contains(' mac' )) {
57+ jpdfiumPlatforms = isArm64 ? [' darwin-arm64' ] : [' darwin-x64' ]
58+ } else if (osName. contains(' win' )) {
59+ if (isArm64) {
60+ logger. lifecycle(" JPDFium natives are not available for windows-arm64; set -PjpdfiumPlatforms=none to skip bundling natives." )
61+ jpdfiumPlatforms = []
62+ } else {
63+ jpdfiumPlatforms = [' windows-x64' ]
64+ }
65+ } else {
66+ // Fallback: bundle all platforms when host can't be determined
67+ jpdfiumPlatforms = jpdfiumAllPlatforms
68+ }
69+ } else if (jpdfiumPlatformsProp == ' all' ) {
4570 jpdfiumPlatforms = jpdfiumAllPlatforms
4671 } else if (jpdfiumPlatformsProp == ' none' ) {
4772 jpdfiumPlatforms = []
@@ -51,7 +76,7 @@ dependencies {
5176 def jpdfiumInvalid = jpdfiumPlatforms. findAll { ! jpdfiumAllPlatforms. contains(it) }
5277 if (jpdfiumInvalid) {
5378 throw new GradleException (" Unknown jpdfiumPlatforms value(s): ${ jpdfiumInvalid.join(', ')} . " +
54- " Valid: ${ jpdfiumAllPlatforms.join(', ')} , 'all' or 'none'." )
79+ " Valid: ${ jpdfiumAllPlatforms.join(', ')} , 'auto', ' all' or 'none'." )
5580 }
5681 logger. lifecycle(" JPDFium native platforms: ${ jpdfiumPlatforms ? jpdfiumPlatforms.join(', ') : 'none'} " )
5782 jpdfiumPlatforms. each { platform ->
0 commit comments