Skip to content

Commit

Permalink
Better validation for trunk security.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennwc committed Oct 31, 2024
1 parent 211fc07 commit b36aa9e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions livekit/sip.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ func (p *UpdateSIPInboundTrunkRequest) Validate() error {
}

func (p *SIPInboundTrunkInfo) Validate() error {
hasAuth := p.AuthUsername != "" || p.AuthPassword != ""
hasCIDR := len(p.AllowedAddresses) != 0
hasNumbers := len(p.Numbers) != 0 // TODO: remove this condition, it doesn't really help with security
if !hasAuth && !hasCIDR && !hasNumbers {
return errors.New("for security, one of the fields must be set: AuthUsername+AuthPassword, AllowedAddresses or Numbers")
}
if err := validateHeaders(p.Headers); err != nil {
return err
}
Expand Down

0 comments on commit b36aa9e

Please sign in to comment.