-
Notifications
You must be signed in to change notification settings - Fork 309
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
Reduce object iterations in NoSQL vulnerabilities #4186
Reduce object iterations in NoSQL vulnerabilities #4186
Conversation
Overall package sizeSelf size: 6.24 MB Dependency sizes
🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4186 +/- ##
=======================================
Coverage 85.22% 85.22%
=======================================
Files 247 247
Lines 10948 10950 +2
Branches 33 33
=======================================
+ Hits 9330 9332 +2
Misses 1618 1618 ☔ View full report in Codecov by Sentry. |
@@ -13,15 +13,18 @@ const KEYS_REGEX_WITHOUT_SENSITIVE_RANGES = new RegExp(`"(${STRINGIFY_RANGE_KEY} | |||
|
|||
const sensitiveValueRegex = new RegExp(DEFAULT_IAST_REDACTION_VALUE_PATTERN, 'gmi') | |||
|
|||
function iterateObject (target, fn, levelKeys = [], depth = 50) { | |||
function iterateObject (target, fn, levelKeys = [], depth = 10, visited = new Set()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reduced it to 10 instead to a 20, because this function is used only when we need to format a nosql vulnerability. The vulnerability is found only in the first levels, so 10 is more than enough to add context for the vulnerability.
BenchmarksBenchmark execution time: 2024-03-25 17:50:03 Comparing candidate commit e7fd46a in PR branch Found 1 performance improvements and 0 performance regressions! Performance is the same for 260 metrics, 5 unstable metrics. scenario:plugin-graphql-with-depth-and-collapse-on-18
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any test for circular reference ?
We already had one, I modified it to work with the new approach (remove circular reference) instead of previous "check depth" |
What does this PR do?
When we format a mongodb injection vulnerability:
Motivation
Improve memory footprint detected in some customers in this method.
Plugin Checklist
Additional Notes
Security
Datadog employees:
@DataDog/security-design-and-guidance
.Unsure? Have a question? Request a review!