Skip to content

Add files via upload#10

Open
antonychiu2 wants to merge 1 commit intomasterfrom
antonychiu2-patch-6
Open

Add files via upload#10
antonychiu2 wants to merge 1 commit intomasterfrom
antonychiu2-patch-6

Conversation

@antonychiu2
Copy link
Owner

No description provided.

@antonychiu2 antonychiu2 reopened this Apr 10, 2025
@antonychiu2
Copy link
Owner Author

antonychiu2 commented Apr 10, 2025

Logo
Checkmarx One – Scan Summary & Detailsdf5fd51b-ee51-426f-81d6-e828294a3f94

Great job, no security vulnerabilities found in this Pull Request

@github-actions
Copy link

image We couldn't fix some of the issues detected by Semgrep

Mobb Fixer gets better and better every day, but unfortunately your current issues aren't supported yet.
For specific requests contact us and we'll do the most to answer your need quickly.

@github-actions
Copy link

image 3 fixes are ready to be committed

Command Injection - 3


def execute_cmd_str_direct(name):
"""convert to list"""
subprocess.run(f"echo 'Hello, {name}!'", shell=True)
Copy link

@github-actions github-actions bot Apr 10, 2025

Choose a reason for hiding this comment

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

image Command Injection fix is ready

This change fixes a high severity (🚩) Command Injection issue reported by Semgrep.

Issue description

Command Injection (CMDI) allows attackers inject malicious commands into vulnerable applications, that can result in execution of arbitrary commands on the underlying operating system.

Fix instructions

Validate or sanitize user input to prevent executing arbitrary commands.

diff --git a/src/main.py b/src/main.py
--- a/src/main.py
+++ b/src/main.py
@@ -3,7 +3,7 @@
 
 def execute_cmd_str_direct(name):
     """convert to list"""
-    subprocess.run(f"echo 'Hello, {name}!'", shell=True)
+    subprocess.run(['echo', f'Hello, {name}!'], shell=True)
 
 def execute_cmd_str_var(name):
     """convert var to list"""
 


Learn more and fine tune the fix


def execute_cmd_list_direct(name):
"""already a safe list, fp"""
subprocess.run(["echo", f"Hello, {name}!"], shell=True)
Copy link

@github-actions github-actions bot Apr 10, 2025

Choose a reason for hiding this comment

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

image Irrelevant issues were spotted - no action required 🧹

The following issues reported by Semgrep on this PR were found to be irrelevant to your project:

Tip

Command Injection - issue was found to be a false positive.
Mobb recommends to ignore this issue, however fix is available if you think differently.

Justification

The flagged code does not represent an actual vulnerability within the application’s context. This categorization indicates that the issue is either misidentified by the scanner or deemed irrelevant to the application’s functionality.

Issue description

Command Injection (CMDI) allows attackers inject malicious commands into vulnerable applications, that can result in execution of arbitrary commands on the underlying operating system.

Learn more and fine tune the issue

"""convert var to list"""
base_command = "echo"
the_cmd = base_command + f"'Hello, {name}!'"
subprocess.run(the_cmd, shell=True)
Copy link

@github-actions github-actions bot Apr 10, 2025

Choose a reason for hiding this comment

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

image Command Injection fix is ready

This change fixes a high severity (🚩) Command Injection issue reported by Semgrep.

Issue description

Command Injection (CMDI) allows attackers inject malicious commands into vulnerable applications, that can result in execution of arbitrary commands on the underlying operating system.

Fix instructions

Validate or sanitize user input to prevent executing arbitrary commands.

diff --git a/src/main.py b/src/main.py
--- a/src/main.py
+++ b/src/main.py
@@ -21,7 +21,7 @@
 def execute_cmd_str_var_concat(name):
     """convert var to list"""
     base_command = "echo"
-    the_cmd = base_command + f"'Hello, {name}!'"
+    the_cmd = [base_command, f"Hello, {name}!"]
     subprocess.run(the_cmd, shell=True)
 
 def execute_cmd_str_var_with_other_usages(name):
 


Learn more and fine tune the fix

def execute_cmd_list_var(name):
"""already a safe list, fp"""
the_cmd = ["echo", f"Hello, {name}!"]
subprocess.run(the_cmd, shell=True)
Copy link

@github-actions github-actions bot Apr 10, 2025

Choose a reason for hiding this comment

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

image Irrelevant issues were spotted - no action required 🧹

The following issues reported by Semgrep on this PR were found to be irrelevant to your project:

Tip

Command Injection - issue was found to be a false positive.
Mobb recommends to ignore this issue, however fix is available if you think differently.

Justification

The flagged code does not represent an actual vulnerability within the application’s context. This categorization indicates that the issue is either misidentified by the scanner or deemed irrelevant to the application’s functionality.

Issue description

Command Injection (CMDI) allows attackers inject malicious commands into vulnerable applications, that can result in execution of arbitrary commands on the underlying operating system.

Learn more and fine tune the issue

def execute_cmd_str_var(name):
"""convert var to list"""
the_cmd = f"echo 'Hello, {name}!'"
subprocess.run(the_cmd, shell=True)
Copy link

@github-actions github-actions bot Apr 10, 2025

Choose a reason for hiding this comment

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

image Command Injection fix is ready

This change fixes a high severity (🚩) Command Injection issue reported by Semgrep.

Issue description

Command Injection (CMDI) allows attackers inject malicious commands into vulnerable applications, that can result in execution of arbitrary commands on the underlying operating system.

Fix instructions

Validate or sanitize user input to prevent executing arbitrary commands.

diff --git a/src/main.py b/src/main.py
--- a/src/main.py
+++ b/src/main.py
@@ -7,7 +7,7 @@
 
 def execute_cmd_str_var(name):
     """convert var to list"""
-    the_cmd = f"echo 'Hello, {name}!'"
+    the_cmd = ['echo', f'Hello, {name}!']
     subprocess.run(the_cmd, shell=True)
 
 def execute_cmd_str_var_multi_line(name):
 


Learn more and fine tune the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant