refactor(iast): remove dead code and fix stale comments in nosql mongodb analyzer#9168
Conversation
Overall package sizeSelf size: 6.52 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.2.0 | 104.26 kB | 843.44 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: fe7c74d | Docs | Datadog PR Page | Give us feedback! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9168 +/- ##
==========================================
- Coverage 93.64% 93.62% -0.03%
==========================================
Files 898 898
Lines 52364 52360 -4
Branches 12324 12324
==========================================
- Hits 49036 49021 -15
- Misses 3328 3339 +11 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
BenchmarksBenchmark execution time: 2026-07-03 06:22:06 Comparing candidate commit fe7c74d in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 2256 metrics, 30 unstable metrics.
|
What does this PR do?
Removes two dead code paths and corrects two stale comments left over from the original mquery instrumentation in
nosql-injection-mongodb-analyzer.jsandmongoose.js. No behavior change.onStartAndBindeliminated. This wrapper calledonStart(message)before returningmarkExecStore().tracing:datadog:mquery:filter:startis published viatracingCh.tracePromise(exec, {}, ...), somessageis always{}andonStartnever found any filters to analyze. TheaddBindnow referencesmarkExecStoredirectly, which is its only real responsibility.return storeremoved fromonStart. The return value was consumed by the oldonStartAndEnterWithStorehelper (removed in fix(iast): isolate the mongodb nosql-analysis marker per request #9076). None of the current call sites — threeaddSubsubscriptions — use the return value.Stale comment on the mquery section corrected. The previous comment stated that
tracing:startis "the first place the filters are available", which has been incorrect sincedatadog:mquery:filter:preparewas added. The new comment describes the actual split of responsibilities between the two channels.Inaccurate comment on
execChinmongoose.jscorrected. The previous comment said "A subscriber returns the store", conflatingaddSub(subscriber, no store control) withaddBind(transform, returns the new store). Reworded to usebindStoreterminology, consistent with themarkExecStorecomment in the same area.Motivation
Cleaning them up now reduces confusion for future maintainers, particularly the
addSub/addBindterminology distinction, which is subtle but load-bearing in understanding how the analysis marker is scoped.Additional Notes
No tests need updating. The existing unit tests in
nosql-injection-mongodb-analyzer.spec.jsand the integration suites for mongoose and mquery cover the unchanged runtime behavior.