Lcos-000 opened a new pull request, #3684:
URL: https://github.com/apache/dubbo-go/pull/3684

   ### Description
   Fixes #3683
   
   `RPCInvocation.ActualMethodName()` 
(`protocol/invocation/rpcinvocation.go:89`) performed an unguarded type 
assertion on the first generic-call argument:
   
   ```go
   func (r *RPCInvocation) ActualMethodName() string {
       if r.IsGenericInvocation() {
           return r.Arguments()[0].(string)   // panics if arg[0] is not a 
string
       }
       return r.MethodName()
   }
   ```
   
   `IsGenericInvocation()` only checks `len(Arguments)==3`, not the element 
types. A malformed `$invoke` with a non-string `arg[0]` reached this line and 
panicked with `interface conversion: interface {} is X, not string`.
   
   This is the same class of bug fixed in #3680 for 
`genericServiceFilter.Invoke`. In the default `DefaultServiceFilters` chain, 
`genericServiceFilter` runs before `otelServerFilter` and short-circuits 
malformed invocations, so `ActualMethodName()` is not reached by default. 
However, the filter order is user-configurable, and if a custom chain places 
`otelServerTrace` before `generic_service` (or omits `generic_service`), the 
panic becomes reachable on the server side via `filter/otel/trace/filter.go:83`.
   
   This PR replaces the bare assertion with comma-ok form. Since 
`ActualMethodName() string` is an interface method on `base.Invocation` with no 
error return, it falls back to `r.MethodName()` on type mismatch (instead of 
returning an error like #3680 did). The interface signature is unchanged; all 7 
call sites are unaffected.
   
   ### Checklist
   - [x] I confirm the target branch is `develop`
   - [x] I have run `make fmt` to format my code
   - [x] I have run `make test` to run local tests
   - [x] I have added tests that prove my fix is effective or that my feature 
works


-- 
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]

Reply via email to