Skip to content

Commit

Permalink
Merge pull request #113 from laowantong/fix-RCE-vulnerabilities
Browse files Browse the repository at this point in the history
Fix RCE vulnerabilities
  • Loading branch information
laowantong committed May 9, 2024
2 parents 3ef367a + 8eb7b87 commit f9368df
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mocodo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path
from importlib import import_module

__version__ = "4.2.6"
__version__ = "4.2.7"
SCRIPT_DIRECTORY = Path(__file__).resolve().parent


Expand Down
4 changes: 2 additions & 2 deletions web/generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
$conversions = array();
foreach ($_POST['conversions'] as $ext) {
if ($ext == "_ddl.sql") {
$transformation_options .= " " . $_POST['sql_case'] . ":labels";
$transformation_options .= " " . escapeshellarg($_POST["sql_case"]) . ":labels";
};
if ($_POST['with_constraints']) {
$option = $transformations[str_replace("_mld", "_mld_with_constraints", $ext)];
Expand Down Expand Up @@ -136,7 +136,7 @@
);
foreach ($default_option_values as $option => $default_value) {
if (isset($_POST[$option]) && ($_POST[$option] != $default_value)) {
$basthon_options .= " --{$option}=" . $_POST[$option];
$basthon_options .= " --{$option}=" . escapeshellarg($_POST[$option]);
};
};
$basthon_options = substr($basthon_options, 1); // strip the first space
Expand Down
2 changes: 1 addition & 1 deletion web/rewrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
} else {
$mocodo = "~/.local/bin/mocodo";
};
$command_line = "{$mocodo} -t " . $_POST['args'] . " 2>&1";
$command_line = "{$mocodo} -t " . escapeshellarg($_POST['args']) . " 2>&1"; //

// Execute the command and test the exit code.
// If it is not 0, return an array with a key "err" and the error message.
Expand Down

0 comments on commit f9368df

Please sign in to comment.