Skip to content

Commit

Permalink
Merge pull request #1 from EffectRenan/master
Browse files Browse the repository at this point in the history
Fix Command Injection vulnerability
  • Loading branch information
huntr.dev | the place to protect open source committed Apr 1, 2021
2 parents 723f44d + a48fd29 commit 4ca6a5c
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 4ca6a5c

Please sign in to comment.