Skip to content

Commit 4218bd7

Browse files
snicollwilkinsona
authored andcommitted
Fix predictable temp directory in Artemis embedded configuration
Update ArtemisEmbeddedConfigurationFactory to use ApplicationTemp for generating the Artemis data directory. This ensures the path is securely generated rather than using a predictable, hardcoded string. Fixes gh-50743
1 parent b2a67be commit 4218bd7

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactory.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package org.springframework.boot.autoconfigure.jms.artemis;
1818

19-
import java.io.File;
20-
2119
import org.apache.activemq.artemis.api.core.QueueConfiguration;
2220
import org.apache.activemq.artemis.api.core.RoutingType;
2321
import org.apache.activemq.artemis.api.core.SimpleString;
@@ -31,6 +29,8 @@
3129
import org.apache.commons.logging.Log;
3230
import org.apache.commons.logging.LogFactory;
3331

32+
import org.springframework.boot.system.ApplicationTemp;
33+
3434
/**
3535
* Configuration used to create the embedded Artemis server.
3636
*
@@ -84,8 +84,7 @@ private String getDataDir() {
8484
if (this.properties.getDataDirectory() != null) {
8585
return this.properties.getDataDirectory();
8686
}
87-
String tempDirectory = System.getProperty("java.io.tmpdir");
88-
return new File(tempDirectory, "artemis-data").getAbsolutePath();
87+
return new ApplicationTemp().getDir("artemis-data").getAbsolutePath();
8988
}
9089

9190
}

0 commit comments

Comments
 (0)