Skip to content

Commit

Permalink
Fix: RPC call causes xray panic problem using wrong account type (#3744)
Browse files Browse the repository at this point in the history
* fix:RPC call causes xray panic problem. Problem details: add a VMess protocol user in an inbound proxy. If inTag: "VMess-xxx", but the developer carelessly calls the add user method of vless or other protocols, such as xrayCtl.AddVlessUser(user), causing xray panic

* fix:use xray log system return error

---------

Co-authored-by: [email protected] <[email protected]>
  • Loading branch information
bestwishCT and [email protected] authored Sep 9, 2024
1 parent 3d0feae commit c90affe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion proxy/vmess/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ func (v *TimedUserValidator) Add(u *protocol.MemoryUser) error {

v.users = append(v.users, u)

account := u.Account.(*MemoryAccount)
account, ok := u.Account.(*MemoryAccount)
if !ok {
return errors.New("account type is incorrect")
}
if !v.behaviorFused {
hashkdf := hmac.New(sha256.New, []byte("VMESSBSKDF"))
hashkdf.Write(account.ID.Bytes())
Expand Down

0 comments on commit c90affe

Please sign in to comment.