Skip to content

Commit

Permalink
Fix Command Injection vulnerability
Browse files Browse the repository at this point in the history
  • Loading branch information
EffectRenan authored Mar 17, 2021
1 parent 723f44d commit a48fd29
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/find.js
Original file line number Diff line number Diff line change
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 a48fd29

Please sign in to comment.