Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,11 @@ public void testMatch() {

@Test
public void testSafe() {
final String command = "T(java.lang.Runtime).getRuntime().exec(\"ls\")";
final boolean isWindows = System.getProperty("os.name").toLowerCase().contains("win");
final String nativeCmd = isWindows ? "cmd /c dir" : "ls";
final String command = "T(java.lang.Runtime).getRuntime().exec(\"" + nativeCmd + "\")";

assertDoesNotThrow(() -> assertNotNull(Runtime.getRuntime().exec("ls")));
assertDoesNotThrow(() -> assertNotNull(Runtime.getRuntime().exec(nativeCmd)));

final StandardExpressionGenerator standardExpressionGenerator = new StandardExpressionGenerator();
final String generate = standardExpressionGenerator.generate("standardSPELExpression|" + command, mockRequest);
Expand Down
Loading