Skip to content
Closed
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions page-object/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<versions.java-security-toolkit>1.1.3</versions.java-security-toolkit>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -68,4 +69,13 @@
</plugin>
</plugins>
</build>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This library holds security tools for protecting Java API calls.

License: MIT ✅ | Open source ✅ | More facts

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.github.pixee</groupId>
<artifactId>java-security-toolkit</artifactId>
<version>${versions.java-security-toolkit}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
6 changes: 6 additions & 0 deletions page-object/sample-application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@
<version>1.26.0-SNAPSHOT</version>
</parent>
<artifactId>sample-application</artifactId>
<dependencies>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This library holds security tools for protecting Java API calls.

License: MIT ✅ | Open source ✅ | More facts

<dependency>
<groupId>io.github.pixee</groupId>
<artifactId>java-security-toolkit</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
package com.iluwatar.pageobject;

import io.github.pixee.security.SystemCommand;
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -79,7 +80,7 @@ public static void main(String[] args) {

} else {
// java Desktop not supported - above unlikely to work for Windows so try instead...
Runtime.getRuntime().exec("cmd.exe start " + applicationFile);
SystemCommand.runCommand(Runtime.getRuntime(), "cmd.exe start " + applicationFile);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of SystemCommand.runCommand with string concatenation to execute a command poses a significant security risk, particularly command injection. If applicationFile is derived from user input or an untrusted source, it could be manipulated to execute arbitrary commands.

To mitigate this risk, consider using a safer approach to execute commands that does not involve concatenation of user-controlled variables. Validate and sanitize any input that forms part of a command, or better yet, use APIs that allow specifying commands and arguments as separate entities to avoid injection vulnerabilities.

}

} catch (IOException ex) {
Expand Down