-
Notifications
You must be signed in to change notification settings - Fork 1
π‘οΈ Sentinel: [CRITICAL] Fix command injection vulnerabilities #493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -262,15 +262,19 @@ export class ToolSmith { | |||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||
| const { exec } = require("child_process"); | ||||||||||||||||||||||||
| const { execFile } = require("child_process"); | ||||||||||||||||||||||||
| const util = require("util"); | ||||||||||||||||||||||||
| const execAsync = util.promisify(exec); | ||||||||||||||||||||||||
| const execAsync = util.promisify(execFile); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| const resourceFlag = resources.length > 0 ? `--resources ${resources.join(",")}` : ""; | ||||||||||||||||||||||||
| const cmd = `python3 "${scriptPath}" ${name} --path "${pathStr}" ${resourceFlag}`; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| console.log(`[ToolSmith] Executing: ${cmd}`); | ||||||||||||||||||||||||
| const { stdout, stderr } = await execAsync(cmd); | ||||||||||||||||||||||||
| const args = [scriptPath, name, "--path", pathStr]; | ||||||||||||||||||||||||
|
Comment on lines
269
to
+273
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π Security & Privacy | π‘ Minor | β‘ Quick win Apply the same cleanup here: avoid interpolated command-string logging. This copy still constructs/logs Suggested patch- const resourceFlag = resources.length > 0 ? `--resources ${resources.join(",")}` : "";
- const cmd = `python3 "${scriptPath}" ${name} --path "${pathStr}" ${resourceFlag}`;
-
- console.log(`[ToolSmith] Executing: ${cmd}`);
const args = [scriptPath, name, "--path", pathStr];
if (resources.length > 0) {
args.push("--resources", resources.join(","));
}
+ console.log("[ToolSmith] Executing python3 with args:", args);π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||
| if (resources.length > 0) { | ||||||||||||||||||||||||
| args.push("--resources", resources.join(",")); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| const { stdout, stderr } = await execAsync("python3", args); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| console.log(stdout); | ||||||||||||||||||||||||
| if (stderr) console.warn(stderr); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π Security & Privacy | π‘ Minor | β‘ Quick win
Remove shell-style interpolated
cmdlogging now thatexecFileis in use.execFilefixed shell injection, but building/logging an interpolated command string fromname,pathStr, andresourcesstill leaves a log-injection/leak surface and keeps the old unsafe pattern alive.Suggested patch
π€ Prompt for AI Agents