Skip to content

refactor(iast): type JSON taint wrapper - #21590

Open
florentinl wants to merge 2 commits into
mainfrom
dd/iast-type-json-taint-wrapper-c2a066f2
Open

florentinl wants to merge 2 commits into
mainfrom
dd/iast-type-json-taint-wrapper-c2a066f2

Conversation

@florentinl

Copy link
Copy Markdown
Contributor

Description

Ap-custom-agent

The JSON taint wrapper lacks checked function contracts, allowing typing errors to go unnoticed.

Changes

  • Type the wrapper's dynamic call boundary and enable checks for the module.

Testing

Four existing JSON and simplejson encoding tests pass on Python 3.9. The module passes mypy with its exemption removed; the tests do not directly exercise the fallback call.

Risks

Low: the annotations do not change the wrapper's control flow.

Additional Notes

No release note is needed for an internal typing-only change.


PR by Bits - View session in Datadog

Comment @DataDog to request changes

Co-authored-by: florentinl <101594032+florentinl@users.noreply.github.com>
@datadog-datadog-prod-us1

Copy link
Copy Markdown
Contributor

View session in Datadog

Bits Code status: ✅ Done

CI Auto-fix: Disabled | Enable

Comment @DataDog to request changes

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot added Bits AI changelog/no-changelog A changelog entry is not required for this PR. labels Nov 9, 2026
@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codeowners resolved as

Resolved from the full PR diff against main using the target branch CODEOWNERS file.
CODEOWNERS team requests not listed below are not required by the current file set.

ddtrace/appsec/_iast/_patches/json_tainting.py                          @DataDog/asm-python
ddtrace/appsec/_iast/_taint_utils.py                                    @DataDog/asm-python
mypy.ini                                                                @DataDog/python-guild @DataDog/apm-core-python

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Dependency direction analysis

⚠️ Existing dependency direction violations

There are 83 dependency direction violations that already exist on the base branch and have not been changed by this PR.

Show existing violations (showing 5 of 83 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=120)
ddtrace.llmobs._integrations.bedrock -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=118)
ddtrace.llmobs._integrations.litellm -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=118)
ddtrace.llmobs._evaluators.runner -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=118)
ddtrace.llmobs._integrations.langchain -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=118)

To see all violations, download the layers-base.json and layers-pr.json artifacts from this CI job and run:

uv run --script scripts/import-analysis/layers.py compare layers-base.json layers-pr.json

@florentinl
florentinl marked this pull request as ready for review November 9, 2026 08:54
@florentinl
florentinl requested review from a team as code owners November 9, 2026 08:54
@florentinl
florentinl requested review from avara1986 and juanjux and removed request for a team November 9, 2026 08:54
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T08:55:58.142002Z f966492 Draft marked ready
🔒 Security Review ✅ Completed 2026-11-09T08:57:47.267347Z f966492 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bits Code Review: PASS

More details

The wrapper’s annotations match its callers, and the static reviewer confirmed that executable logic is unchanged after removing annotations. No actionable regression was identified.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit f966492

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Pipelines  Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: f966492 | Docs | View more details | Give us feedback!

@pr-commenter

pr-commenter Bot commented Nov 9, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-11-09 09:12:49

Comparing candidate commit f966492 in PR branch dd/iast-type-json-taint-wrapper-c2a066f2 with baseline commit e44a5f7 in branch main.

📊 Benchmarking dashboard

Found 1 performance improvements and 0 performance regressions! Performance is the same for 577 metrics, 10 unstable metrics, 1 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:errortrackingmonitoring-production_handler

  • 🟩 max_rss_usage [-24.005MB; -23.928MB] or [-52.200%; -52.032%]

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:coreapiscenario-context_with_data_listeners

  • unstable execution_time [-724.487ns; +736.305ns] or [-6.783%; +6.893%]

scenario:coreapiscenario-core_dispatch_1_listener

  • unstable execution_time [-32.375ns; +37.523ns] or [-4.679%; +5.423%]

scenario:coreapiscenario-core_dispatch_50_listeners

  • unstable execution_time [-2012.670ns; +1823.439ns] or [-10.063%; +9.117%]

scenario:coreapiscenario-core_dispatch_exception_listeners

  • unstable execution_time [-1978.758ns; +1688.021ns] or [-10.240%; +8.735%]

scenario:coreapiscenario-core_dispatch_listeners

  • unstable execution_time [-376.049ns; +377.975ns] or [-8.764%; +8.809%]

scenario:coreapiscenario-core_dispatch_no_args_listeners

  • unstable execution_time [-228.090ns; +223.576ns] or [-8.415%; +8.249%]

scenario:coreapiscenario-core_dispatch_with_results_1_listener

  • unstable execution_time [-89.923ns; +93.613ns] or [-6.041%; +6.289%]

scenario:coreapiscenario-core_dispatch_with_results_50_listeners

  • unstable execution_time [-4492.801ns; +5204.705ns] or [-8.892%; +10.301%]

scenario:coreapiscenario-core_dispatch_with_results_listeners

  • unstable execution_time [-1040.792ns; +959.342ns] or [-9.735%; +8.973%]

scenario:packagesupdateimporteddependencies-import_many_stdlib_cached

  • unstable execution_time [-48.845µs; +62.049µs] or [-8.440%; +10.722%]

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

Known flaky benchmarks without significant changes:

  • scenario:packagespackageforrootmodulemapping-cache_off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bits AI changelog/no-changelog A changelog entry is not required for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants