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.2.0</versions.java-security-toolkit>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -68,4 +69,13 @@
</plugin>
</plugins>
</build>
<dependencyManagement>
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

<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 to execute a system command (cmd.exe start) poses a significant security risk. This method of opening files can be susceptible to command injection if the file path is manipulated or not properly sanitized. Recommendation: Consider safer alternatives such as using the Java Desktop API across all platforms or handling file paths more securely to prevent potential command injection.

}

} catch (IOException ex) {

Choose a reason for hiding this comment

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

The exception handling in this block only logs the error without providing a user notification or a recovery mechanism. This approach might leave the user unaware of the failure if they do not have access to the logs. Recommendation: Enhance the error handling by implementing a user notification system or a retry mechanism to improve the application's robustness and user experience.

Expand Down
Loading