-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
TypeError: Cannot read property 'type' of undefined in detect-child-process rule #69
Comments
Summary Still relevant? Next steps
|
Good catch! The extra check for non-empty array is correct. A simple example which also brokes the rule implementation:
Output:
@XERXES-MOUSAVI , thank you! would you like to write a PR? |
XERXES-MOUSAVI
pushed a commit
to XERXES-MOUSAVI/eslint-plugin-security
that referenced
this issue
May 30, 2022
See also this merge request for a similar bug. |
Closed by #97 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
I get TypeError while linter is detecting MemberExpression of
detect-child-process
rule. The problem occurs while it's checking theexec()
method. I'm using Mongoose as ODM to work with MongoDB. As it references here, there is anexec()
method on its Query prototype to execute what query or callback we expect. But it is namesake withchild_process.exec()
and linter throws TypeError on every line that MongooseQuery.exec()
appears.https://github.com/nodesecurity/eslint-plugin-security/blob/edd1ae27245b0b220cbfdab59c3aaa0d279fea3d/rules/detect-child-process.js#L33-L37
Possible Solution
As I checked
node.parent.arguments
, there is no arguments while linting Mongoose exec(). I tested multiple scenarios ofchild_process.exec()
and MongooseQuery.exec()
. So that I believe if we check the emptiness of the arguments, the problem will be solved.The text was updated successfully, but these errors were encountered: