github-advanced-security[bot] commented on code in PR #2391:
URL: 
https://github.com/apache/incubator-kie-tools/pull/2391#discussion_r1622782179


##########
packages/maven-config-setup-helper/index.js:
##########
@@ -17,13 +17,31 @@
  * under the License.
  */
 
+const { execSync } = require("child_process");
 const fs = require("fs");
 const path = require("path");
 
 const MVN_CONFIG_ORIGINAL_FILE_PATH = path.join(".mvn", 
"maven.config.original");
 const MVN_CONFIG_FILE_PATH = path.join(".mvn", "maven.config");
 
 module.exports = {
+  setPomProperty: ({ key, value }) => {
+    if (!key || !value) {
+      console.error("[maven-config-setup-helper] Wrong values provided");
+      process.exit(1);
+    }
+
+    if (process.platform === "win32") {
+      execSync(`mvn versions:set-property \`-Dproperty=${key} 
\`-DnewVersion=${value} \`-DgenerateBackupPoms=false`, {
+        stdio: "inherit",
+        shell: "powershell.exe",
+      });
+    } else {
+      execSync(`mvn versions:set-property -Dproperty=${key} 
-DnewVersion=${value} -DgenerateBackupPoms=false`, {

Review Comment:
   ## Unsafe shell command constructed from library input
   
   This string concatenation which depends on [library input](1) is later used 
in a [shell command](2).
   This string concatenation which depends on [library input](1) is later used 
in a [shell command](2).
   
   [Show more 
details](https://github.com/apache/incubator-kie-tools/security/code-scanning/831)



##########
packages/maven-config-setup-helper/index.js:
##########
@@ -17,13 +17,31 @@
  * under the License.
  */
 
+const { execSync } = require("child_process");
 const fs = require("fs");
 const path = require("path");
 
 const MVN_CONFIG_ORIGINAL_FILE_PATH = path.join(".mvn", 
"maven.config.original");
 const MVN_CONFIG_FILE_PATH = path.join(".mvn", "maven.config");
 
 module.exports = {
+  setPomProperty: ({ key, value }) => {
+    if (!key || !value) {
+      console.error("[maven-config-setup-helper] Wrong values provided");
+      process.exit(1);
+    }
+
+    if (process.platform === "win32") {
+      execSync(`mvn versions:set-property \`-Dproperty=${key} 
\`-DnewVersion=${value} \`-DgenerateBackupPoms=false`, {

Review Comment:
   ## Unsafe shell command constructed from library input
   
   This string concatenation which depends on [library input](1) is later used 
in a [shell command](2).
   This string concatenation which depends on [library input](1) is later used 
in a [shell command](2).
   
   [Show more 
details](https://github.com/apache/incubator-kie-tools/security/code-scanning/830)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to