bosprimigenious opened a new issue, #1075:
URL: https://github.com/apache/dubbo-go-pixiu/issues/1075

   ### Verification checklist
   
   - [x] Searched open/closed issues and PRs for proxyrewrite, uri_regex, 
regexp, and rewrite/panic; inspected the current open PR file lists and related 
#307, #948, #980. No current matching fix found in the inspected public records.
   
   ### Environment
   
   - Go 1.25.14, macOS arm64.
   - Current `develop` commit `51198ddd8d1317f6c1d7e351fde8a6be7da60d62`, 
unchanged `go.mod` / `go.sum`.
   - No registry/server required for the reproduction.
   
   ### Bug description
   
   The proxy-rewrite factory's `Apply()` checks only that `uri_regex` has two 
entries. An invalid regular expression is accepted, then `PrepareFilterChain()` 
panics in `regexp.MustCompile`. The filter manager already propagates `Apply()` 
errors as `create fail`, so configuration validation can reject this before a 
request chain is prepared.
   
   This reproduces a factory/chain-construction panic; I have not run a 
complete deployed gateway to claim a process-wide crash.
   
   ### Steps to reproduce
   
   Run this from the repository root:
   
   ```go
   package main
   
   import (
       "fmt"
       "github.com/apache/dubbo-go-pixiu/pkg/common/extension/filter"
       "github.com/apache/dubbo-go-pixiu/pkg/filter/http/proxyrewrite"
   )
   
   func main() {
       factory, err := filter.NewEmptyFilterManager().Apply(proxyrewrite.Kind,
           map[string]any{"uri_regex": []string{"[", "/"}})
       fmt.Println("apply:", err)
       if err != nil { return }
       _ = factory.PrepareFilterChain(nil, filter.NewDefaultFilterChain())
   }
   ```
   
   ### Actual behavior
   
   ```text
   apply: <nil>
   panic: regexp: Compile(`[`): error parsing regexp: missing closing ]: `[`
   ```
   
   The same happens with `(`, `[z-a]`, `*`, and a trailing backslash. The valid 
capture expression `^/([^/]*)/(.*)$` / `/$2` works normally.
   
   ### Expected behavior / possible solution
   
   Compile the pattern during `Apply()` and return the syntax error through the 
existing configuration-error path. Keep valid rewrites and existing two-entry 
validation unchanged. This does not attempt to support concurrent mutation of a 
published factory's configuration or bypassing its `Apply()` lifecycle.
   
   ### Attribution
   
   Investigation and this report were prepared with OpenAI Codex; reproductions 
were run against the precise unchanged commit above. No human review or 
deployment validation is claimed.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

  • [I] [BUG] Invalid proxy-rew... bosprimigenious (via GitHub) via notifications

Reply via email to