Skip to content

🍒 11649 - Improve performance of regexps in IAST and query obfuscator#11710

Merged
manuel-alvarez-alvarez merged 1 commit into
release/v1.63.xfrom
malvarez/backport-pr-11649
Jun 25, 2026
Merged

🍒 11649 - Improve performance of regexps in IAST and query obfuscator#11710
manuel-alvarez-alvarez merged 1 commit into
release/v1.63.xfrom
malvarez/backport-pr-11649

Conversation

@manuel-alvarez-alvarez

Copy link
Copy Markdown
Member

Backport #11649 to release/v1.63.x

@manuel-alvarez-alvarez
manuel-alvarez-alvarez requested review from a team as code owners June 23, 2026 15:25
@manuel-alvarez-alvarez manuel-alvarez-alvarez added type: feature Enhancements and improvements tag: performance Performance related changes comp: asm iast Application Security Management (IAST) tag: ai generated Largely based on code generated by an AI or LLM labels Jun 23, 2026
@manuel-alvarez-alvarez manuel-alvarez-alvarez added type: feature Enhancements and improvements tag: performance Performance related changes comp: asm iast Application Security Management (IAST) labels Jun 23, 2026
@manuel-alvarez-alvarez manuel-alvarez-alvarez added the tag: ai generated Largely based on code generated by an AI or LLM label Jun 23, 2026

@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: a004f21de6

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@pr-commenter

pr-commenter Bot commented Jun 23, 2026

Copy link
Copy Markdown

Debugger benchmarks

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
ci_job_date 1782376713 1782377060
end_time 2026-06-25T08:39:59 2026-06-25T08:45:45
git_branch master malvarez/backport-pr-11649
git_commit_sha ac2d5498f7 3d95b09
start_time 2026-06-25T08:38:34 2026-06-25T08:44:21
See matching parameters
Baseline Candidate
ci_job_id 1803418353 1803418353
ci_pipeline_id 120986049 120986049
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
git_commit_date 1782375896 1782375896

Summary

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

See unchanged results
scenario Δ mean agg_http_req_duration_min Δ mean agg_http_req_duration_p50 Δ mean agg_http_req_duration_p75 Δ mean agg_http_req_duration_p99 Δ mean throughput
scenario:noprobe unstable
[-43.621µs; +17.013µs] or [-14.435%; +5.630%]
unstable
[-62.021µs; +22.741µs] or [-17.787%; +6.522%]
unstable
[-75.367µs; +29.664µs] or [-20.585%; +8.102%]
unstable
[-11.355µs; +276.469µs] or [-0.954%; +23.231%]
same
scenario:basic same same same unstable
[+60.824µs; +259.474µs] or [+5.718%; +24.394%]
unstable
[-78.519op/s; +200.470op/s] or [-3.219%; +8.219%]
scenario:loop same same same same same
Request duration reports for reports
gantt
    title reports - request duration [CI 0.99] : candidate=None, baseline=None
    dateFormat X
    axisFormat %s
section baseline
noprobe (348.695 µs) : 297, 400
.   : milestone, 349,
basic (300.378 µs) : 293, 308
.   : milestone, 300,
loop (8.99 ms) : 8984, 8996
.   : milestone, 8990,
section candidate
noprobe (329.055 µs) : 305, 353
.   : milestone, 329,
basic (296.782 µs) : 290, 303
.   : milestone, 297,
loop (8.995 ms) : 8990, 9000
.   : milestone, 8995,
Loading
  • baseline results
Scenario Request median duration [CI 0.99]
noprobe 348.695 µs [297.127 µs, 400.263 µs]
basic 300.378 µs [292.791 µs, 307.966 µs]
loop 8.99 ms [8.984 ms, 8.996 ms]
  • candidate results
Scenario Request median duration [CI 0.99]
noprobe 329.055 µs [304.821 µs, 353.288 µs]
basic 296.782 µs [290.149 µs, 303.414 µs]
loop 8.995 ms [8.99 ms, 9.0 ms]

Migrate the IAST evidence-redaction regexps to RE2/J for linear-time
matching. RE2/J has no back-references, so the SQL tokenizer is reworked
to find Postgres dollar-quoted literals via a precomputed tag index
(binary search) and to enumerate Oracle q'...' delimiters explicitly
instead of relying on a back-reference. Configured redaction patterns
that are valid under java.util.regex but unsupported by RE2/J fall back
to the defaults instead of failing to compile.

Replace the query obfuscator's `while (matcher.find())` + per-match
`Strings.replace` loop (O(N*Q)) with a single appendReplacement /
appendTail pass (O(Q)).

Add JUnit 5 tests for the tokenizers and the obfuscator, a tokenizer
JMH benchmark, and migrate SensitiveHandlerTest from Groovy to JUnit 5.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
(cherry picked from commit 92ebc2a)
@manuel-alvarez-alvarez
manuel-alvarez-alvarez force-pushed the malvarez/backport-pr-11649 branch from a004f21 to 3d95b09 Compare June 25, 2026 08:25

@PerfectSlayer PerfectSlayer 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.

Re-applying the original approval to the backport PR.

@manuel-alvarez-alvarez
manuel-alvarez-alvarez merged commit 7ed9344 into release/v1.63.x Jun 25, 2026
765 of 767 checks passed
@manuel-alvarez-alvarez
manuel-alvarez-alvarez deleted the malvarez/backport-pr-11649 branch June 25, 2026 12:27
@manuel-alvarez-alvarez manuel-alvarez-alvarez added this to the 1.63.1 milestone Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: asm iast Application Security Management (IAST) tag: ai generated Largely based on code generated by an AI or LLM tag: performance Performance related changes type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants