按源保护 PythonPlugin TOPLEVEL 路径边界
This commit is contained in:
@@ -92,10 +92,16 @@ grep -F 'return vsnprintf(buffer, size, fmt, args);' \
|
||||
"$linuxcnc_root/src/rtapi/uspace_common.h" >/dev/null
|
||||
grep -F 'class PythonPlugin' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.hh" >/dev/null
|
||||
grep -F 'PLUGIN_PYTHON_NOT_INITIALIZED = -12,' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.hh" >/dev/null
|
||||
grep -F 'PLUGIN_BAD_PATH = -5,' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.hh" >/dev/null
|
||||
grep -F 'PLUGIN_NO_CALLABLE = 1,' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.hh" >/dev/null
|
||||
grep -F 'PLUGIN_EXCEPTION = 2' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.hh" >/dev/null
|
||||
grep -F 'PythonPlugin::instantiate' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.cc" >/dev/null
|
||||
grep -F 'if (status < PLUGIN_OK)' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.cc" >/dev/null
|
||||
grep -F 'if (auto inistring = inifile.findString("TOPLEVEL", section)) {' \
|
||||
"$linuxcnc_root/src/emc/pythonplugin/python_plugin.cc" >/dev/null
|
||||
grep -F 'if (realpath(toplevel, real_path) == NULL) {' \
|
||||
"$linuxcnc_root/src/emc/pythonplugin/python_plugin.cc" >/dev/null
|
||||
grep -F 'status = PLUGIN_BAD_PATH;' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.cc" >/dev/null
|
||||
grep -F 'retval = bp::exec_file(cmd, main_namespace, main_namespace);' \
|
||||
"$linuxcnc_root/src/emc/pythonplugin/python_plugin.cc" >/dev/null
|
||||
grep -F 'retval = bp::exec(cmd, main_namespace, main_namespace);' \
|
||||
@@ -317,6 +323,9 @@ for forbidden in [
|
||||
raise SystemExit(f"PythonPlugin wasm shim must not execute Python: {forbidden}")
|
||||
for needle in [
|
||||
"python disabled in wasm-safe probe",
|
||||
'find_ini_value(iniFilename, section, "TOPLEVEL", toplevel)',
|
||||
"realpath(toplevel.c_str(), resolved_path) == nullptr",
|
||||
"status = PLUGIN_BAD_PATH;",
|
||||
"status = PLUGIN_PYTHON_NOT_INITIALIZED;",
|
||||
"return PLUGIN_NO_CALLABLE;",
|
||||
"status = PLUGIN_EXCEPTION;",
|
||||
@@ -327,6 +336,7 @@ for needle in [
|
||||
for needle in [
|
||||
"PLUGIN_NO_SECTION",
|
||||
"PLUGIN_BAD_INIFILE",
|
||||
"PLUGIN_BAD_PATH",
|
||||
"PLUGIN_PYTHON_NOT_INITIALIZED",
|
||||
"PLUGIN_NO_CALLABLE",
|
||||
"PLUGIN_EXCEPTION",
|
||||
@@ -407,6 +417,7 @@ for phrase in [
|
||||
"must not execute `bp::exec`, `bp::exec_file`, or",
|
||||
"inactive-DB return values",
|
||||
"negative-status short-circuit behavior",
|
||||
"preserve the `TOPLEVEL` missing-path `PLUGIN_BAD_PATH` edge",
|
||||
"LinuxCNC `rcs_print_error` split entry points",
|
||||
"without native print routing",
|
||||
"LinuxCNC userspace `rtapi_snprintf()` formatting",
|
||||
|
||||
Reference in New Issue
Block a user