-
Notifications
You must be signed in to change notification settings - Fork 1
fix(MESHCENT-004-2): 4 review findings across 2 files #148
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: master
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 |
|---|---|---|
| @@ -1,4 +1,7 @@ | ||
|
|
||
| /*jshint node: true */ | ||
| /*jshint strict: false */ | ||
| "use strict"; | ||
| var http = require('http'); | ||
| var childProcess = require('child_process'); | ||
| var meshCoreObj = { "action": "coreinfo", "value": "MeshCore Recovery", "caps": 14 }; // Capability bitmask: 1 = Desktop, 2 = Terminal, 4 = Files, 8 = Console, 16 = JavaScript | ||
|
|
@@ -255,18 +258,22 @@ require('MeshAgent').AddCommandHandler(function (data) | |
| break; | ||
| case 'mkdir': { | ||
| // Create a new empty folder | ||
| if ((cmd.path == null) || (cmd.path.indexOf('..') >= 0)) { break; } | ||
| fs.mkdirSync(cmd.path); | ||
| break; | ||
| } | ||
| case 'mkfile': { | ||
| // Create a new empty file | ||
| if ((cmd.path == null) || (cmd.path.indexOf('..') >= 0)) { break; } | ||
| fs.closeSync(fs.openSync(cmd.path, 'w')); | ||
| break; | ||
| } | ||
| case 'rm': { | ||
| // Delete, possibly recursive delete | ||
| if ((cmd.path == null) || (cmd.path.indexOf('..') >= 0)) { break; } | ||
| for (var i in cmd.delfiles) | ||
| { | ||
| if ((cmd.delfiles[i] == null) || (cmd.delfiles[i].indexOf('..') >= 0)) { continue; } | ||
| try { deleteFolderRecursive(path.join(cmd.path, cmd.delfiles[i]), cmd.rec); } catch (e) { } | ||
| } | ||
|
Author
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. 𦩠π΄ mkdir/mkfile commands use raw cmd.path without '..' traversal validation In the WebSocket file-command handler (protocol 5 switch), added π€ Prompt for AI agentsfix confidence: π‘ 80 medium β react π/π to teach the reviewer |
||
| break; | ||
|
Comment on lines
258
to
279
Author
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. 𦩠π΄ File deletion command 'rm' processes user-supplied paths without a '..' traversal check In the π€ Prompt for AI agentsfix confidence: π‘ 65 medium β react π/π to teach the reviewer |
||
|
|
@@ -469,3 +476,4 @@ function deleteFolderRecursive(path, rec) { | |
| fs.unlinkSync(path); | ||
| } | ||
| }; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,7 @@ stop() { | |
| else | ||
| echo 'Service not running' | ||
| fi | ||
| rm -f $"PIDFILE" | ||
| rm -f "$PIDFILE" | ||
| fi | ||
|
Author
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. 𦩠π΄ meshinstall-initd.sh builds and eval's a command string containing unescaped shell metacharacters via su -c In the stop() function, changed π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
| } | ||
| restart(){ | ||
|
|
@@ -82,3 +82,4 @@ case "$1" in | |
| ;; | ||
| esac | ||
| exit 0 | ||
|
|
||
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.
𦩠π agentrecoverycore.js is missing jshint header and 'use strict'
Added the standard header block (
/*jshint node: true */,/*jshint strict: false */,"use strict";) at the top of the file, immediately before the existingvar http = require('http');line, matching the convention used in other server-side modules; no other lines were altered.π€ Prompt for AI agents
fix confidence: π’ 90 high β react π/π to teach the reviewer