Skip to content

Commit a285aa2

Browse files
committed
[server] validate the PROVISION prefix hello on the mu/v1 channel
1 parent fae82a0 commit a285aa2

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

sessionproto/control.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,17 @@ func ValidateHelloShape(hello *ClientHello, expectedVersion uint32) error {
114114
return fmt.Errorf("room-exchange hello is missing payload")
115115
}
116116
return nil
117+
case ClientHelloType_CLIENT_HELLO_TYPE_PROVISION:
118+
// PROVISION rides the mu/v1 WRAP channel as a non-terminal prefix hello
119+
// before the session hello, so it is validated here too (not only on the
120+
// raw pre-mu path). It carries a provision payload, no session data.
121+
if len(hello.GetSessionId()) != 0 || hello.GetStreamId() != 0 {
122+
return fmt.Errorf("provision hello must not contain session data")
123+
}
124+
if hello.GetProvision() == nil {
125+
return fmt.Errorf("provision hello is missing payload")
126+
}
127+
return nil
117128
default:
118129
return fmt.Errorf("unsupported client hello type: %s", hello.GetType())
119130
}

0 commit comments

Comments
 (0)