Skip to content

fix: failing appsec tests after iitm bump to v2.0.0#6935

Merged
BridgeAR merged 12 commits intomasterfrom
pabloerhard/iitm-appsec-fix
Dec 18, 2025
Merged

fix: failing appsec tests after iitm bump to v2.0.0#6935
BridgeAR merged 12 commits intomasterfrom
pabloerhard/iitm-appsec-fix

Conversation

@pabloerhard
Copy link
Copy Markdown
Contributor

@pabloerhard pabloerhard commented Nov 17, 2025

What does this PR do?

This PR aims to fix appsec tests failing after bumping iitm to version 2.0.0

Motivation

iitm version 2.0.0 includes changes that include files being rewritten from CommonJS to ESM, which caused the conditions in the isEsmConfigured function to fail. This happened because the files are no longer keys in the require.cache. This PR adds the flag --import dd-trace/initialize.mjs as an early return statement to bypass the issues caused by the iitm change.

Plugin Checklist

Additional Notes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 17, 2025

Overall package size

Self size: 4.35 MB
Deduped: 5.18 MB
No deduping: 5.18 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.0 | 68.46 kB | 797.03 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.78%. Comparing base (b08f6e9) to head (67ffe04).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6935      +/-   ##
==========================================
+ Coverage   84.77%   84.78%   +0.01%     
==========================================
  Files         521      521              
  Lines       22157    22155       -2     
==========================================
+ Hits        18784    18785       +1     
+ Misses       3373     3370       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@datadog-datadog-prod-us1

This comment has been minimized.

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Nov 17, 2025

Benchmarks

Benchmark execution time: 2025-12-17 23:05:52

Comparing candidate commit 67ffe04 in PR branch pabloerhard/iitm-appsec-fix with baseline commit b08f6e9 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 288 metrics, 32 unstable metrics.

@pabloerhard pabloerhard changed the title Fixed failing appsec tests after iitm bump to v2.0.0 fix: failing appsec tests after iitm bump to v2.0.0 Nov 18, 2025
@pabloerhard pabloerhard force-pushed the pabloerhard/iitm-appsec-fix branch from ad23362 to 0499959 Compare November 18, 2025 03:46
@pabloerhard pabloerhard marked this pull request as ready for review November 18, 2025 04:15
@pabloerhard pabloerhard requested review from a team as code owners November 18, 2025 04:15
Copy link
Copy Markdown
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the import being more general. The other part is optional.

Comment thread packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js Outdated
Comment thread packages/datadog-esbuild/src/utils.js Outdated
uurien
uurien previously requested changes Nov 18, 2025
Comment thread packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js Outdated
@pabloerhard pabloerhard force-pushed the pabloerhard/iitm-appsec-fix branch from 91e3958 to cc057b0 Compare November 18, 2025 16:49
@pabloerhard pabloerhard requested a review from bengl November 18, 2025 21:16
bengl
bengl previously requested changes Nov 18, 2025
Comment thread packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js Outdated
Copy link
Copy Markdown
Contributor Author

@pabloerhard pabloerhard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added dd-trace/initialize.mjs and dd-trace/register.js as flags to consider when checking whether ESM is configured, since these are the options provided in Datadog’s documentation. ESM does not directly expose the module cache, so a direct alternative to require.cache does not currently exist. I added this general comment so we can further discuss any other options or concerns, as the two open comments relate to this change.
@bengl @BridgeAR @uurien

@pabloerhard pabloerhard force-pushed the pabloerhard/iitm-appsec-fix branch from 47f2a1a to 42c78f3 Compare November 19, 2025 19:07
Comment thread packages/datadog-esbuild/src/utils.js Outdated
Comment thread package.json Outdated
Copy link
Copy Markdown
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % @uurien 's comment. It would remove the overhead of checking for that more than once (which will not show up anywhere, but it is still nice).

Comment thread packages/datadog-esbuild/src/utils.js Outdated
@pabloerhard pabloerhard requested a review from BridgeAR November 24, 2025 00:18
@pabloerhard pabloerhard force-pushed the pabloerhard/iitm-appsec-fix branch from ed8d73b to bc6fe98 Compare November 26, 2025 14:44
@pabloerhard pabloerhard force-pushed the pabloerhard/iitm-appsec-fix branch from bc6fe98 to c50ef6c Compare December 8, 2025 15:55
Copy link
Copy Markdown
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the debug log removed

Comment thread packages/datadog-esbuild/src/utils.js Outdated
@pabloerhard pabloerhard requested a review from BridgeAR December 11, 2025 15:36
@pabloerhard pabloerhard force-pushed the pabloerhard/iitm-appsec-fix branch from 4794b75 to 73490a7 Compare December 17, 2025 22:28
@BridgeAR BridgeAR requested a review from bengl December 17, 2025 23:19
@BridgeAR BridgeAR dismissed stale reviews from uurien and bengl December 17, 2025 23:21

Comments addressed

@BridgeAR BridgeAR merged commit d9a3a8e into master Dec 18, 2025
793 checks passed
@BridgeAR BridgeAR deleted the pabloerhard/iitm-appsec-fix branch December 18, 2025 16:24
dd-octo-sts Bot pushed a commit that referenced this pull request Dec 19, 2025
* Added support for iitm v2.0.0

* Update iitm with master package.json and yarn.lock
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Dec 19, 2025
nina9753 pushed a commit that referenced this pull request Dec 20, 2025
* Added support for iitm v2.0.0

* Update iitm with master package.json and yarn.lock
nina9753 pushed a commit that referenced this pull request Jan 15, 2026
* Added support for iitm v2.0.0

* Update iitm with master package.json and yarn.lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants