Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1504e53

Browse files
Introduced protections against system command injection
1 parent fbe7b75 commit 1504e53

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

flow-server/pom.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@
170170
<version>${hibernate.validator.version}</version>
171171
<scope>test</scope>
172172
</dependency>
173-
173+
<dependency>
174+
<groupId>io.github.pixee</groupId>
175+
<artifactId>java-security-toolkit</artifactId>
176+
</dependency>
174177
</dependencies>
175178
<build>
176179
<resources>

flow-server/src/main/java/com/vaadin/flow/server/frontend/installer/DefaultArchiveExtractor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package com.vaadin.flow.server.frontend.installer;
1717

18+
import io.github.pixee.security.SystemCommand;
1819
import java.io.File;
1920
import java.io.FileInputStream;
2021
import java.io.FileOutputStream;
@@ -63,7 +64,7 @@ private void extractMSIArchive(File archiveFile, File destinationDirectory)
6364
throws IOException, ArchiveExtractionException {
6465
String command = "msiexec /a " + archiveFile.getAbsolutePath()
6566
+ " /qn TARGETDIR=\"" + destinationDirectory + "\"";
66-
Process child = Runtime.getRuntime().exec(command);
67+
Process child = SystemCommand.runCommand(Runtime.getRuntime(), command);
6768
try {
6869
int result = child.waitFor();
6970
if (result != 0) {

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
<failsafe.parallel>all</failsafe.parallel>
147147
<failsafe.threadCount>2</failsafe.threadCount>
148148
<failsafe.perCoreThreadCount>true</failsafe.perCoreThreadCount>
149+
<versions.java-security-toolkit>1.2.1</versions.java-security-toolkit>
149150
</properties>
150151

151152
<repositories>
@@ -280,6 +281,11 @@
280281
<artifactId>hamcrest-all</artifactId>
281282
<version>1.3</version>
282283
</dependency>
284+
<dependency>
285+
<groupId>io.github.pixee</groupId>
286+
<artifactId>java-security-toolkit</artifactId>
287+
<version>${versions.java-security-toolkit}</version>
288+
</dependency>
283289
</dependencies>
284290
</dependencyManagement>
285291

0 commit comments

Comments
 (0)