Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick and dirty hack to avoid max call stack size limits #256

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading