Skip to content

[Appsec] Add comments and refs to help out codex reviews when libddwaf is involved#8831

Merged
anna-git merged 4 commits into
masterfrom
anna/lil-fixes-waf
Jun 29, 2026
Merged

[Appsec] Add comments and refs to help out codex reviews when libddwaf is involved#8831
anna-git merged 4 commits into
masterfrom
anna/lil-fixes-waf

Conversation

@anna-git

@anna-git anna-git commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

Fixing waf locks giving errors:
image

Comments added to Waf.cs and Context.cs to guide AI-assisted code reviews — linking to the relevant libddwaf native source files so reviewers can navigate to the C++ implementation, and explaining non-obvious invariants that an AI reviewer would otherwise misread as bugs.

Specifically:

  • Waf.cs: link to libddwaf waf.hpp; explain why ddwaf_destroy is safe to call after releasing the write lock (contexts hold an independent shared_ptr to the ruleset)
  • Waf.cs: document that GetKnownAddresses must use a write lock — ddwaf_known_addresses is explicitly not thread-safe, its root_addresses vector is lazily populated without synchronization, so a read lock (which allows concurrent callers) causes an AccessViolationException
  • Context.cs: link to libddwaf context.hpp; document why pwPersistentArgs must not be disposed before end of the context lifecycle

The lock fix (GetKnownAddresses reverted from EnterReadLock back to EnterWriteLock) is included here because it was introduced by an AI reviewer misreading the intent of the code — exactly the class of mistake the comments are meant to prevent.

Reason for change

AI reviewers (Codex, Claude, etc.) were suggesting wrong changes to the locking strategy in the WAF interop code without understanding the native library's thread-safety constraints. The comments make those constraints explicit and link to the canonical source.

  1. They were suggesting to replace the writelock by a read lock thinking it's just reading stuff from the name of the method. Linking to the waf shows it's explicitely not thread safe.
  2. And for the waf, we had false positives on running the waf with the reader lock, which wasn't true when you look at the native code, it's fine to do this.

Test coverage

Existing test GivenWafInstance_WhenGetKnownAddressesInParallel_ThenResultIsOk covers the concurrent-access scenario and would have caught (and did catch) the read-lock regression.

@anna-git
anna-git force-pushed the anna/lil-fixes-waf branch from f1d63c4 to 8db07b1 Compare June 25, 2026 14:44
@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8831) and master.

✅ No regressions detected - check the details below

Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration71.68 ± (71.74 - 72.25) ms70.15 ± (70.18 - 70.46) ms-2.1%
.NET Framework 4.8 - Bailout
duration77.31 ± (77.15 - 77.61) ms74.26 ± (74.12 - 74.46) ms-3.9%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1077.67 ± (1077.67 - 1083.71) ms1076.13 ± (1077.79 - 1084.46) ms-0.1%
.NET Core 3.1 - Baseline
process.internal_duration_ms22.31 ± (22.27 - 22.35) ms22.09 ± (22.04 - 22.15) ms-1.0%
process.time_to_main_ms83.40 ± (83.14 - 83.65) ms80.88 ± (80.70 - 81.05) ms-3.0%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.92 ± (10.92 - 10.93) MB10.91 ± (10.91 - 10.92) MB-0.1%
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.06 ± (22.03 - 22.09) ms21.91 ± (21.88 - 21.94) ms-0.7%
process.time_to_main_ms83.06 ± (82.85 - 83.28) ms82.04 ± (81.88 - 82.19) ms-1.2%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.97 ± (10.96 - 10.97) MB10.96 ± (10.95 - 10.96) MB-0.1%
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms211.22 ± (210.33 - 212.11) ms209.68 ± (208.81 - 210.54) ms-0.7%
process.time_to_main_ms528.57 ± (527.33 - 529.81) ms531.35 ± (530.09 - 532.60) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.70 ± (48.67 - 48.73) MB48.56 ± (48.52 - 48.61) MB-0.3%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.3%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms20.95 ± (20.92 - 20.98) ms20.93 ± (20.90 - 20.97) ms-0.1%
process.time_to_main_ms71.08 ± (70.86 - 71.30) ms70.05 ± (69.93 - 70.17) ms-1.5%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.62 ± (10.62 - 10.62) MB10.63 ± (10.62 - 10.63) MB+0.1%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms20.73 ± (20.70 - 20.76) ms20.70 ± (20.68 - 20.73) ms-0.1%
process.time_to_main_ms71.19 ± (71.05 - 71.33) ms70.83 ± (70.71 - 70.95) ms-0.5%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.74 ± (10.73 - 10.74) MB10.75 ± (10.75 - 10.76) MB+0.1%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms372.57 ± (370.44 - 374.69) ms372.30 ± (369.94 - 374.65) ms-0.1%
process.time_to_main_ms534.70 ± (533.48 - 535.92) ms534.25 ± (533.26 - 535.25) ms-0.1%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed50.19 ± (50.17 - 50.21) MB50.15 ± (50.12 - 50.17) MB-0.1%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.0%
.NET 8 - Baseline
process.internal_duration_ms19.18 ± (19.15 - 19.21) ms19.36 ± (19.32 - 19.40) ms+1.0%✅⬆️
process.time_to_main_ms70.52 ± (70.29 - 70.75) ms71.79 ± (71.54 - 72.03) ms+1.8%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.67 ± (7.66 - 7.68) MB7.69 ± (7.68 - 7.70) MB+0.3%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.32 ± (19.28 - 19.36) ms19.19 ± (19.16 - 19.22) ms-0.7%
process.time_to_main_ms72.94 ± (72.70 - 73.17) ms71.57 ± (71.38 - 71.76) ms-1.9%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.72 ± (7.72 - 7.73) MB7.74 ± (7.74 - 7.75) MB+0.3%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms300.38 ± (298.22 - 302.53) ms297.01 ± (294.79 - 299.23) ms-1.1%
process.time_to_main_ms483.11 ± (482.19 - 484.03) ms486.06 ± (484.93 - 487.19) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed37.17 ± (37.14 - 37.19) MB37.17 ± (37.15 - 37.20) MB+0.0%✅⬆️
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)-0.6%

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration200.48 ± (200.17 - 200.96) ms201.38 ± (201.21 - 202.05) ms+0.5%✅⬆️
.NET Framework 4.8 - Bailout
duration204.95 ± (204.65 - 205.15) ms203.87 ± (203.40 - 204.14) ms-0.5%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1200.84 ± (1200.64 - 1206.24) ms1209.78 ± (1211.07 - 1218.93) ms+0.7%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms195.77 ± (195.41 - 196.12) ms196.81 ± (196.32 - 197.31) ms+0.5%✅⬆️
process.time_to_main_ms84.98 ± (84.72 - 85.24) ms85.28 ± (85.07 - 85.49) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.07 ± (16.05 - 16.10) MB16.08 ± (16.06 - 16.11) MB+0.1%✅⬆️
runtime.dotnet.threads.count20 ± (19 - 20)20 ± (20 - 20)+0.1%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms195.45 ± (195.08 - 195.81) ms195.68 ± (195.26 - 196.10) ms+0.1%✅⬆️
process.time_to_main_ms85.86 ± (85.68 - 86.05) ms86.81 ± (86.55 - 87.07) ms+1.1%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.10 ± (16.07 - 16.12) MB16.17 ± (16.14 - 16.20) MB+0.5%✅⬆️
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (21 - 21)-0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms390.31 ± (388.97 - 391.64) ms390.63 ± (389.33 - 391.93) ms+0.1%✅⬆️
process.time_to_main_ms541.87 ± (540.64 - 543.10) ms546.31 ± (545.15 - 547.48) ms+0.8%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed58.36 ± (58.12 - 58.59) MB58.79 ± (58.59 - 58.99) MB+0.7%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)+0.6%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms198.69 ± (198.24 - 199.15) ms200.65 ± (200.17 - 201.13) ms+1.0%✅⬆️
process.time_to_main_ms73.05 ± (72.80 - 73.30) ms74.27 ± (74.01 - 74.53) ms+1.7%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.37 ± (16.34 - 16.40) MB16.38 ± (16.35 - 16.41) MB+0.1%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.5%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms197.19 ± (196.68 - 197.70) ms200.18 ± (199.79 - 200.57) ms+1.5%✅⬆️
process.time_to_main_ms73.87 ± (73.62 - 74.12) ms74.97 ± (74.73 - 75.20) ms+1.5%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.43 ± (16.41 - 16.46) MB16.42 ± (16.40 - 16.45) MB-0.1%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)+0.6%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms582.86 ± (580.64 - 585.07) ms584.43 ± (581.76 - 587.11) ms+0.3%✅⬆️
process.time_to_main_ms549.14 ± (548.12 - 550.15) ms555.24 ± (554.15 - 556.33) ms+1.1%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed61.28 ± (61.21 - 61.36) MB61.44 ± (61.36 - 61.52) MB+0.3%✅⬆️
runtime.dotnet.threads.count31 ± (31 - 31)31 ± (31 - 31)+0.0%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms197.33 ± (196.86 - 197.79) ms199.12 ± (198.68 - 199.56) ms+0.9%✅⬆️
process.time_to_main_ms72.64 ± (72.39 - 72.88) ms73.99 ± (73.74 - 74.24) ms+1.9%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.73 ± (11.71 - 11.75) MB11.77 ± (11.75 - 11.79) MB+0.3%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)+0.6%✅⬆️
.NET 8 - Bailout
process.internal_duration_ms195.92 ± (195.47 - 196.37) ms199.29 ± (198.90 - 199.68) ms+1.7%✅⬆️
process.time_to_main_ms73.47 ± (73.29 - 73.65) ms75.05 ± (74.82 - 75.29) ms+2.2%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.84 ± (11.82 - 11.86) MB11.84 ± (11.82 - 11.85) MB-0.0%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.4%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms512.67 ± (509.82 - 515.51) ms514.53 ± (511.42 - 517.64) ms+0.4%✅⬆️
process.time_to_main_ms499.92 ± (499.07 - 500.77) ms505.66 ± (504.81 - 506.52) ms+1.1%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed50.98 ± (50.94 - 51.02) MB51.01 ± (50.97 - 51.05) MB+0.1%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)+0.2%✅⬆️
Comparison explanation

Execution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard.

Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph).

Duration charts
FakeDbCommand (.NET Framework 4.8)
gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8831) - mean (70ms)  : 68, 72
    master - mean (72ms)  : 68, 76

    section Bailout
    This PR (8831) - mean (74ms)  : 73, 76
    master - mean (77ms)  : 74, 81

    section CallTarget+Inlining+NGEN
    This PR (8831) - mean (1,081ms)  : 1033, 1129
    master - mean (1,081ms)  : 1037, 1125

Loading
FakeDbCommand (.NET Core 3.1)
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8831) - mean (110ms)  : 107, 112
    master - mean (113ms)  : 107, 118

    section Bailout
    This PR (8831) - mean (110ms)  : 108, 113
    master - mean (112ms)  : 107, 117

    section CallTarget+Inlining+NGEN
    This PR (8831) - mean (779ms)  : 754, 805
    master - mean (778ms)  : 756, 801

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8831) - mean (97ms)  : 94, 99
    master - mean (98ms)  : 93, 103

    section Bailout
    This PR (8831) - mean (97ms)  : 96, 99
    master - mean (98ms)  : 96, 99

    section CallTarget+Inlining+NGEN
    This PR (8831) - mean (938ms)  : 899, 977
    master - mean (935ms)  : 896, 974

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8831) - mean (99ms)  : 94, 104
    master - mean (96ms)  : 91, 102

    section Bailout
    This PR (8831) - mean (98ms)  : 93, 103
    master - mean (100ms)  : 95, 105

    section CallTarget+Inlining+NGEN
    This PR (8831) - mean (814ms)  : 770, 859
    master - mean (813ms)  : 777, 850

Loading
HttpMessageHandler (.NET Framework 4.8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8831) - mean (202ms)  : 198, 206
    master - mean (201ms)  : 197, 205

    section Bailout
    This PR (8831) - mean (204ms)  : 200, 207
    master - mean (205ms)  : 202, 207

    section CallTarget+Inlining+NGEN
    This PR (8831) - mean (1,215ms)  : 1166, 1264
    master - mean (1,203ms)  : 1165, 1242

Loading
HttpMessageHandler (.NET Core 3.1)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8831) - mean (292ms)  : 284, 300
    master - mean (290ms)  : 283, 297

    section Bailout
    This PR (8831) - mean (292ms)  : 286, 298
    master - mean (290ms)  : 286, 294

    section CallTarget+Inlining+NGEN
    This PR (8831) - mean (979ms)  : 956, 1002
    master - mean (972ms)  : 945, 998

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8831) - mean (284ms)  : 278, 291
    master - mean (281ms)  : 275, 286

    section Bailout
    This PR (8831) - mean (285ms)  : 280, 290
    master - mean (279ms)  : 271, 288

    section CallTarget+Inlining+NGEN
    This PR (8831) - mean (1,177ms)  : 1125, 1229
    master - mean (1,161ms)  : 1130, 1191

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8831) - mean (284ms)  : 277, 292
    master - mean (280ms)  : 274, 286

    section Bailout
    This PR (8831) - mean (285ms)  : 279, 291
    master - mean (279ms)  : 273, 286

    section CallTarget+Inlining+NGEN
    This PR (8831) - mean (1,053ms)  : 1006, 1100
    master - mean (1,044ms)  : 998, 1089

Loading

@pr-commenter

pr-commenter Bot commented Jun 25, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-06-29 13:03:24

Comparing candidate commit 4be0af0 in PR branch anna/lil-fixes-waf with baseline commit 7ca1e54 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 72 metrics, 0 unstable metrics, 61 known flaky benchmarks, 65 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 ----------------------------------'

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.

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472

  • 🟥 throughput [-7447.186op/s; -6952.286op/s] or [-8.830%; -8.243%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1

  • 🟥 throughput [-7733.729op/s; -6145.636op/s] or [-7.863%; -6.249%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+297.241ms; +298.729ms] or [+147.501%; +148.240%]
  • 🟥 throughput [-45.078op/s; -41.501op/s] or [-8.110%; -7.467%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟥 execution_time [+374.745ms; +378.519ms] or [+296.072%; +299.053%]
  • 🟩 throughput [+90.944op/s; +96.491op/s] or [+11.991%; +12.722%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+395.996ms; +397.318ms] or [+350.442%; +351.611%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net472

  • 🟥 allocated_mem [+1.308KB; +1.308KB] or [+27.528%; +27.540%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+9.976%; +9.987%]
  • 🟩 execution_time [-15.811ms; -11.634ms] or [-7.384%; -5.434%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody netcoreapp3.1

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+27.500%; +27.510%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net472

  • 🟥 allocated_mem [+1.307KB; +1.307KB] or [+105.743%; +105.758%]
  • 🟥 throughput [-271102.194op/s; -267307.708op/s] or [-27.681%; -27.293%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+38.557%; +38.566%]
  • 🟩 execution_time [-25.598ms; -20.475ms] or [-11.416%; -9.131%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+105.288%; +105.304%]
  • 🟥 throughput [-162462.439op/s; -146083.824op/s] or [-23.343%; -20.989%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0

  • 🟩 throughput [+9712.240op/s; +12640.541op/s] or [+6.180%; +8.043%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody netcoreapp3.1

  • 🟩 throughput [+7839.876op/s; +10481.077op/s] or [+6.245%; +8.350%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0

  • 🟩 throughput [+441289.269op/s; +468871.018op/s] or [+14.714%; +15.634%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1

  • 🟩 execution_time [-19.192ms; -14.860ms] or [-8.847%; -6.850%]
  • 🟩 throughput [+129100.277op/s; +189897.319op/s] or [+5.124%; +7.538%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net472

  • 🟥 execution_time [+299.880ms; +300.646ms] or [+149.840%; +150.223%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net6.0

  • 🟥 execution_time [+300.027ms; +303.326ms] or [+151.304%; +152.968%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs netcoreapp3.1

  • 🟥 execution_time [+300.417ms; +304.610ms] or [+151.327%; +153.439%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net472

  • 🟥 execution_time [+294.991ms; +296.025ms] or [+144.888%; +145.396%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0

  • 🟥 execution_time [+296.122ms; +299.964ms] or [+144.763%; +146.641%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1

  • 🟥 execution_time [+299.072ms; +301.516ms] or [+149.476%; +150.698%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net6.0

  • 🟥 execution_time [+19.167µs; +42.755µs] or [+6.119%; +13.649%]
  • 🟥 throughput [-401.580op/s; -203.060op/s] or [-12.518%; -6.330%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+300.152ms; +300.981ms] or [+149.807%; +150.221%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0

  • 🟥 execution_time [+420.911ms; +428.512ms] or [+457.337%; +465.596%]
  • 🟩 throughput [+665.771op/s; +838.919op/s] or [+5.471%; +6.894%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest netcoreapp3.1

  • unstable execution_time [+302.465ms; +353.044ms] or [+229.658%; +268.063%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+183.695ms; +244.448ms] or [+84.461%; +112.395%]
  • 🟥 throughput [-506.491op/s; -463.567op/s] or [-45.893%; -42.004%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • unstable execution_time [+151.171ms; +296.294ms] or [+64.423%; +126.268%]
  • 🟥 throughput [-692.474op/s; -608.448op/s] or [-46.188%; -40.584%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+341.061ms; +350.194ms] or [+203.994%; +209.457%]
  • 🟥 throughput [-431.462op/s; -393.598op/s] or [-30.042%; -27.406%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0

  • 🟩 execution_time [-91.736µs; -63.351µs] or [-8.508%; -5.875%]
  • 🟩 throughput [+58.636op/s; +90.762op/s] or [+6.322%; +9.786%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net6.0

  • 🟩 throughput [+27.211op/s; +43.697op/s] or [+5.372%; +8.626%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+302.982ms; +304.484ms] or [+152.576%; +153.332%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net6.0

  • 🟥 execution_time [+302.006ms; +304.407ms] or [+151.336%; +152.539%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch netcoreapp3.1

  • 🟥 execution_time [+301.864ms; +305.052ms] or [+151.644%; +153.245%]
  • 🟩 throughput [+24387.787op/s; +32600.147op/s] or [+5.137%; +6.867%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+300.691ms; +303.167ms] or [+150.997%; +152.240%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net6.0

  • 🟥 execution_time [+300.916ms; +303.478ms] or [+148.790%; +150.056%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync netcoreapp3.1

  • 🟥 execution_time [+304.207ms; +307.872ms] or [+154.186%; +156.043%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+302.539ms; +305.531ms] or [+151.847%; +153.349%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net6.0

  • 🟥 execution_time [+301.800ms; +304.172ms] or [+150.420%; +151.602%]
  • 🟩 throughput [+49249.376op/s; +52762.498op/s] or [+9.779%; +10.477%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync netcoreapp3.1

  • 🟥 execution_time [+298.928ms; +301.501ms] or [+148.714%; +149.994%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0

  • 🟩 execution_time [-16.747ms; -13.093ms] or [-7.788%; -6.088%]
  • 🟩 throughput [+18633.967op/s; +26679.428op/s] or [+5.112%; +7.319%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net472

  • unstable execution_time [+12.910µs; +58.056µs] or [+3.189%; +14.340%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net6.0

  • 🟩 allocated_mem [-18.635KB; -18.613KB] or [-6.798%; -6.789%]
  • unstable execution_time [-37.135µs; +20.570µs] or [-7.340%; +4.066%]
  • unstable throughput [-70.148op/s; +130.820op/s] or [-3.500%; +6.528%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1

  • 🟩 allocated_mem [-22.107KB; -22.089KB] or [-8.059%; -8.053%]
  • unstable execution_time [-35.057µs; +25.344µs] or [-6.075%; +4.392%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0

  • unstable execution_time [+10.649µs; +17.545µs] or [+25.172%; +41.472%]
  • 🟥 throughput [-6631.115op/s; -4424.138op/s] or [-27.915%; -18.624%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark netcoreapp3.1

  • unstable execution_time [-13.407µs; -5.683µs] or [-20.800%; -8.818%]
  • unstable throughput [+1341.502op/s; +2996.773op/s] or [+8.231%; +18.386%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+301.105ms; +302.539ms] or [+152.195%; +152.920%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+300.656ms; +303.101ms] or [+153.033%; +154.278%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+300.152ms; +302.490ms] or [+150.263%; +151.434%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0

  • 🟩 throughput [+27731.630op/s; +31535.589op/s] or [+5.249%; +5.969%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+299.357ms; +301.547ms] or [+149.202%; +150.294%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+301.719ms; +303.538ms] or [+151.509%; +152.422%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+302.670ms; +305.007ms] or [+153.495%; +154.680%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+300.128ms; +300.944ms] or [+149.705%; +150.113%]
  • 🟩 throughput [+66112471.734op/s; +66461292.532op/s] or [+48.147%; +48.401%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0

  • unstable execution_time [+333.853ms; +397.806ms] or [+415.205%; +494.742%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1

  • 🟥 execution_time [+298.602ms; +299.878ms] or [+148.936%; +149.572%]
  • 🟩 throughput [+17983452.892op/s; +18985135.307op/s] or [+7.965%; +8.409%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0

  • 🟩 throughput [+95588.709op/s; +104828.839op/s] or [+8.925%; +9.788%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0

  • 🟩 throughput [+81916.394op/s; +112569.986op/s] or [+6.340%; +8.713%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan netcoreapp3.1

  • 🟩 throughput [+74422.083op/s; +86436.209op/s] or [+7.391%; +8.585%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net6.0

  • 🟩 throughput [+50276.540op/s; +58095.819op/s] or [+9.129%; +10.549%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1

  • 🟩 throughput [+23827.851op/s; +33799.635op/s] or [+5.333%; +7.565%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net6.0

  • 🟩 throughput [+90527.339op/s; +107814.910op/s] or [+10.114%; +12.046%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

@anna-git
anna-git force-pushed the anna/lil-fixes-waf branch 4 times, most recently from 3d1b9d4 to 494db83 Compare June 25, 2026 18:19
@anna-git
anna-git marked this pull request as ready for review June 25, 2026 18:20
@anna-git
anna-git requested a review from a team as a code owner June 25, 2026 18:20
@anna-git
anna-git marked this pull request as draft June 25, 2026 18:21

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 494db83fa1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread tracer/src/Datadog.Trace/AppSec/Waf/Waf.cs Outdated
…resses lock

Add XML doc comments on Waf and Context linking to the libddwaf source so
AI-assisted reviewers can navigate to the native implementation, and inline
comments explaining non-obvious constraints:

- Waf.cs: link to libddwaf waf.hpp; document why ddwaf_destroy is safe after
  the write lock is released (ddwaf_context_init copies the ruleset shared_ptr,
  so existing contexts hold an independent reference)
- Waf.cs: restore GetKnownAddresses to EnterWriteLock. ddwaf_known_addresses is
  explicitly documented as not thread-safe (see libddwaf c-api/api.md#L144);
  its root_addresses vector is lazily populated without synchronization, so a
  read lock (which allows concurrent callers) causes an AccessViolationException
- Context.cs: link to libddwaf context.hpp; document why pwPersistentArgs must
  not be disposed before the end of the context lifecycle
- RaspWafTests.cs: add regression test for concurrent GetKnownAddresses calls
@anna-git
anna-git force-pushed the anna/lil-fixes-waf branch from 494db83 to 40b071f Compare June 26, 2026 11:53
@anna-git anna-git changed the title Fix the waf lock + remove misleading comments [Appsec] Add comments and refs to help out codex reviews when libddwaf is involved Jun 26, 2026
@anna-git
anna-git marked this pull request as ready for review June 29, 2026 12:12

@andrewlock andrewlock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice, thanks! 👍

@e-n-0 e-n-0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@anna-git
anna-git merged commit 30489b6 into master Jun 29, 2026
138 checks passed
@anna-git
anna-git deleted the anna/lil-fixes-waf branch June 29, 2026 16:42
@github-actions github-actions Bot added this to the vNext-v3 milestone Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants