Skip to content

Commit

Permalink
Short circuit hasTaintedMethod and reduce calling
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanKingston committed Jun 22, 2023
1 parent aff1438 commit 5978475
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,13 @@ export function hasTaintedMethod (scope, shouldStackCheck = false) {
if (!shouldStackCheck || !taintedOrigins()) {
return false
}
const currentTaintedOrigins = taintedOrigins()
if (!currentTaintedOrigins) {
return false
}
const stackOrigins = getStackTraceOrigins(getStack())
for (const stackOrigin of stackOrigins) {
if (taintedOrigins()?.has(stackOrigin)) {
if (currentTaintedOrigins.has(stackOrigin)) {
return true
}
}
Expand Down

0 comments on commit 5978475

Please sign in to comment.