Skip to content

Commit

Permalink
Merge pull request #44 from 418sec/1-npm-find-process
Browse files Browse the repository at this point in the history
Security Fix for Command Injection - huntr.dev
  • Loading branch information
yibn2008 committed May 8, 2021
2 parents 723f44d + 4ca6a5c commit 872c18a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/find.js
Expand Up @@ -57,7 +57,12 @@ function find (by, value, strict) {
if (!(by in findBy)) {
reject(new Error(`do not support find by "${by}"`))
} else {
findBy[by](value, strict).then(resolve, reject)
if (by === 'pid' && typeof value !== 'number')
reject(new Error(`pid must be a number`))
else if (by === 'port' && typeof value !== 'number')
reject(new Error(`port must be a number`))
else
findBy[by](value, strict).then(resolve, reject)
}
})
}
Expand Down

0 comments on commit 872c18a

Please sign in to comment.