[ 
https://issues.apache.org/jira/browse/CAMEL-26470?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Adriano Machado updated CAMEL-26470:
------------------------------------
    Description: 
Tier 2 item of CAMEL-25132. PatternHelper.matchPattern compiles a regular 
expression for every name that is not an exact or wildcard match, so 
{{removeHeaders("Camel*")}}, which the security checklist recommends, compiles 
one per remaining header on every exchange. The ticket measured about 930 ns 
and 7.6 KB per exchange with 12 headers.

A pattern without regex metacharacters cannot match anything beyond the exact 
and wildcard checks, except that a trailing {{*}} also means zero or more of 
the previous character, so {{Camel*}} matches the name {{Came}}. Such patterns 
can skip the compile unless the name has exactly that shape. Other patterns 
still compile, and the matching result must not change.

_Claude Code on behalf of Adriano Machado (@ammachado)_

_This was generated by an AI agent and may contain inaccuracies. Please verify 
before relying on it._

  was:
Tier 2 item of CAMEL\-25132. PatternHelper.matchPattern compiles a regular 
expression for every name that is not an exact or wildcard match, so 
removeHeaders\("Camel\*"\), which the security checklist recommends, compiles 
one per remaining header on every exchange. The ticket measured about 930 ns 
and 7.6 KB per exchange with 12 headers.

A pattern without regex metacharacters cannot match anything beyond the exact 
and wildcard checks, except that a trailing \* also means zero or more of the 
previous character, so Camel\* matches the name Came. Such patterns can skip 
the compile unless the name has exactly that shape. Other patterns still 
compile, and the matching result must not change.

_Claude Code on behalf of Adriano Machado \(@ammachado\)_

_This was generated by an AI agent and may contain inaccuracies. Please verify 
before relying on it._




> camel-support - PatternHelper: do not compile a regular expression for a 
> pattern without metacharacters
> -------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26470
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26470
>             Project: Camel
>          Issue Type: Sub-task
>            Reporter: Adriano Machado
>            Assignee: Adriano Machado
>            Priority: Major
>             Fix For: 4.24.0
>
>
> Tier 2 item of CAMEL-25132. PatternHelper.matchPattern compiles a regular 
> expression for every name that is not an exact or wildcard match, so 
> {{removeHeaders("Camel*")}}, which the security checklist recommends, 
> compiles one per remaining header on every exchange. The ticket measured 
> about 930 ns and 7.6 KB per exchange with 12 headers.
> A pattern without regex metacharacters cannot match anything beyond the exact 
> and wildcard checks, except that a trailing {{*}} also means zero or more of 
> the previous character, so {{Camel*}} matches the name {{Came}}. Such 
> patterns can skip the compile unless the name has exactly that shape. Other 
> patterns still compile, and the matching result must not change.
> _Claude Code on behalf of Adriano Machado (@ammachado)_
> _This was generated by an AI agent and may contain inaccuracies. Please 
> verify before relying on it._



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to