fix: remove shell=True to prevent shell injection vulnerabilities#2139
Open
Jah-yee wants to merge 4 commits intoTEN-framework:mainfrom
Open
fix: remove shell=True to prevent shell injection vulnerabilities#2139Jah-yee wants to merge 4 commits intoTEN-framework:mainfrom
Jah-yee wants to merge 4 commits intoTEN-framework:mainfrom
Conversation
added 4 commits
April 5, 2026 02:58
Security fix for issue TEN-framework#2107: - Changed subprocess.run(shell=True) to subprocess.run(shell=False) - Use shlex.split() to properly parse command strings - This prevents shell injection vulnerabilities
- Replace shell=True with shell=False + shlex.split() to prevent shell injection - Apply fix to 2 affected run_script.py files - Addresses security issues reported in TEN-framework#2106 and TEN-framework#2107
…njection Security vulnerability reported in: - Issue TEN-framework#2107: subprocess function 'run' with 'shell=True' - Issue TEN-framework#2106: subprocess invocation uses shell=True This change replaces all subprocess.run() calls with shell=True with subprocess.run() using shell=False via shlex.split() for safe command parsing. Files fixed: - packages/core_apps/default_app_cpp/tools/run_script.py - packages/core_extensions/default_extension_cpp/tools/run_script.py - packages/core_extensions/default_extension_nodejs/tests/bin/start.py
Security fix: Removing shell=True from subprocess.run() calls to prevent shell injection vulnerabilities. When shell=True, the command is executed through a shell, which can be exploited if untrusted input is passed. Reported in issues TEN-framework#2107 and TEN-framework#2106
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Security fix: Removing
shell=Truefromsubprocess.run()calls to prevent shell injection vulnerabilities.Changes
tests/ten_runtime/integration/nodejs/standalone_test_nodejs_2/default_extension_nodejs/tests/bin/start.py: Removedshell=Truefrom 3 subprocess.run() callstests/ten_runtime/integration/nodejs/standalone_test_nodejs_3/default_extension_nodejs/tests/bin/start.py: Removedshell=Truefrom 2 subprocess.run() callsWhy
When
shell=True, the command is executed through a shell, which can be exploited if untrusted input is passed to the command. By removingshell=True:This fix addresses issues #2107 and #2106.
Testing
The changes maintain the same functionality - npm install, build, and test commands still work correctly. The difference is that the commands are now executed more securely without shell interpretation.