-
Notifications
You must be signed in to change notification settings - Fork 200
Added new detect-child-process
rule (#252)
#855
Conversation
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.
Good start! Some structural & documentation feedback.
Sorry for taking so long to get to this! I'm happy to discuss here or on gitter.im if any of the feedback doesn't make sense! |
@JoshuaKGoldberg Thanks for your feedback! I've just updated the code, please review Do we need to handle |
Ooh, good question. No, let's ignore that for now. Direct AMD modules are falling out of favor and most rules don't bother with them. |
@JoshuaKGoldberg Anything else should be changed in this PR? |
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.
LGTM, thanks!
Just a couple of nitpicks on the metadata text that I'll merge in. Looks like I don't have permissions. @soon would you mind committing the suggestions? This is good to go otherwise! 🚀
README.md
Outdated
</td> | ||
<td> | ||
Detects usages of child_process and especially child_process.exec() with a non-literal first argument. | ||
It is dangerous to pass a string constructed at runtime as the first argument to the child_process.exec(). |
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.
It is dangerous to pass a string constructed at runtime as the first argument to the child_process.exec(). | |
It is dangerous to pass a string constructed at runtime as the first argument to <code>child_process.exec()</code>. |
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.
Fixed
README.md
Outdated
<td> | ||
Detects usages of child_process and especially child_process.exec() with a non-literal first argument. | ||
It is dangerous to pass a string constructed at runtime as the first argument to the child_process.exec(). | ||
<code>child_process.exec(cmd)</code> runs <code>cmd</code> as a shell command which allows attacker to execute malicious code injected into <code>cmd</code> string. |
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.
<code>child_process.exec(cmd)</code> runs <code>cmd</code> as a shell command which allows attacker to execute malicious code injected into <code>cmd</code> string. | |
<code>child_process.exec(cmd)</code> runs <code>cmd</code> as a shell command which could allow an attacker to execute malicious code injected into <code>cmd</code>. |
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.
Fixed
@JoshuaKGoldberg Commited your changes |
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.
Fantastic, thanks @soon! 🎉
PR checklist
Overview of change:
Added new
detect-child-process
rule.Is there anything you'd like reviewers to focus on?
Spelling (docs), Rule meta (not sure about issueClass, severity and level).