[BUG] — `String.matches(...)` (Pattern.compile per call) per line per AI request/response (multiple sites)
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
- severity: Medium-High
- files: `AiResponseTransformerPlugin.java:259` (`line.matches("^(GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD)\\s.*\\sHTTP/1.1$")` in `extractHeadersFromAiResponse`, iterated per line of every response), `AiRequestTransformerPlugin.java:286` (identical pattern, per line per request), `AiRequestTransformerPlugin.java:250` (`newPath.matches("^/[a-zA-Z0-9/_\\-]*$")` per request)
- description: `String.matches` compiles a `Pattern` on every invocation (JDK does not cache it); called in a `while(readLine)` loop for the request-line variants.
- impact: Regex compilation per line per AI request/response.
- suggested_fix: Precompile `private static final Pattern REQUEST_LINE_PATTERN = Pattern.compile(...)` and use `.matcher(line).matches()`.
- confidence: High
---
_Identified during the 2026-08-02 deep re-scan; full list in [`docs/scan2-2026-08-02/06-medium-tiers.md`](docs/scan2-2026-08-02/06-medium-tiers.md)._
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in AiResponseTransformerPlugin.java:259 and AiRequestTransformerPlugin.java:250,286, reading extractHeadersFromAiResponse and the surrounding request transformation flow. Check the listed matches calls and confirm request and response processing avoid compiling the same regular expressions on each invocation while preserving their current matching behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100