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-alvarezmanuel-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-alvarezmanuel-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-alvarezmanuel-alvarez-alvarez added the tag: ai generated Largely based on code generated by an AI or LLM label Jun 23, 2026

@chatgpt-codex-connectorchatgpt-codex-connectorBot 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-commenterBot commented Jun 23, 2026

Copy link
Copy Markdown

Debugger benchmarks

Parameters

BaselineCandidate
baseline_or_candidatebaselinecandidate
ci_job_date17823767131782377060
end_time2026-06-25T08:39:592026-06-25T08:45:45
git_branchmastermalvarez/backport-pr-11649
git_commit_shaac2d5498f73d95b09
start_time2026-06-25T08:38:342026-06-25T08:44:21
See matching parameters
BaselineCandidate
ci_job_id18034183531803418353
ci_pipeline_id120986049120986049
cpu_modelIntel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHzIntel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
git_commit_date17823758961782375896

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:noprobeunstable
[-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:basicsamesamesameunstable
[+60.824µs; +259.474µs] or [+5.718%; +24.394%]
unstable
[-78.519op/s; +200.470op/s] or [-3.219%; +8.219%]
scenario:loopsamesamesamesamesame
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
ScenarioRequest median duration [CI 0.99]
noprobe348.695 µs [297.127 µs, 400.263 µs]
basic300.378 µs [292.791 µs, 307.966 µs]
loop8.99 ms [8.984 ms, 8.996 ms]
  • candidate results
ScenarioRequest median duration [CI 0.99]
noprobe329.055 µs [304.821 µs, 353.288 µs]
basic296.782 µs [290.149 µs, 303.414 µs]
loop8.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) <noreply@anthropic.com>
(cherry picked from commit 92ebc2a)

@PerfectSlayerPerfectSlayer left a comment

Copy link
Copy Markdown
Collaborator

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.xJun 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-alvarezmanuel-alvarez-alvarez added this to the 1.63.1 milestone Jun 25, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: asm iastApplication Security Management (IAST)tag: ai generatedLargely based on code generated by an AI or LLMtag: performancePerformance related changestype: featureEnhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@manuel-alvarez-alvarez@PerfectSlayer