Skip to content

Commit

Permalink
Merge pull request #256 from pulsar-edit/no-max-call-stack
Browse files Browse the repository at this point in the history
Quick and dirty hack to avoid max call stack size limits
  • Loading branch information
confused-Techie authored Jun 28, 2024
2 parents 00ccbc9 + 26412a4 commit fcad58f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/models/callStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = class CallStack {
}

// Attempts to remove any sensitive data that may be found within
sanitize(content) {
sanitize(content, depth = 0) {
const badKeys = [
"token",
"password",
Expand Down Expand Up @@ -52,7 +52,18 @@ module.exports = class CallStack {
if (badKeys.includes(key)) {
outContent[key] = hideString;
} else {
outContent[key] = this.sanitize(content[key]);
if (depth > 15) {
// TODO Dirty hack to avoid hitting the callstack when parsing
// web request results that consist of many referenced duplicated objects
// that seemingly could descend forever.
// 15 is a arbitrarily chosen value of depth to not go past to
// avoid this error.
// pulsar-edit/package-backend#252
outContent[key] = content[key];
break;
}

outContent[key] = this.sanitize(content[key], depth++);
}
}
break;
Expand Down

0 comments on commit fcad58f

Please sign in to comment.