Skip to content

Commit

Permalink
Shorten function
Browse files Browse the repository at this point in the history
  • Loading branch information
hansott committed Dec 18, 2024
1 parent f1cd857 commit d1917f7
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions library/helpers/attackPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ export function getPathsToPayload(
const attackPayloadLowercase = attackPayload.toLowerCase();

const traverse = (value: unknown, path: PathPart[] = [], depth = 0) => {
if (matches.found()) {
return;
}

if (depth > MAX_DEPTH) {
if (matches.found() || depth > MAX_DEPTH) {
return;
}

Expand All @@ -86,8 +82,6 @@ export function getPathsToPayload(
if (jwt.jwt) {
traverse(jwt.object, path.concat({ type: "jwt" }), depth + 1);
}

return;
}

if (Array.isArray(value)) {
Expand All @@ -107,8 +101,6 @@ export function getPathsToPayload(

traverse(item, path.concat({ type: "array", index }), depth);
}

return;
}

if (isPlainObject(value)) {
Expand All @@ -119,8 +111,6 @@ export function getPathsToPayload(

traverse(value[key], path.concat({ type: "object", key }), depth + 1);
}

return;
}
};

Expand Down

0 comments on commit d1917f7

Please sign in to comment.