-
Notifications
You must be signed in to change notification settings - Fork 0
Introduced protections against system command injection #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,10 @@ | |
<version>1.26.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>sample-application</artifactId> | ||
<dependencies> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
---|---|---|
|
@@ -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; | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of 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) { | ||
|
There was a problem hiding this comment.
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