Files
livekit/pkg/service/export_test.go
T
Pradeep SharmaandClaude Opus 5.5 dbfafc1fdb ingress: check reserved and IPv4-embedding ranges for URL pull hosts
Also reject 198.18.0.0/15 and 240.0.0.0/4. For NAT64 (64:ff9b::/96)
and 6to4 (2002::/16) addresses, check the embedded IPv4 address instead
of the IPv6 one, so a public source reached through NAT64 still works
while an internal one is rejected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 16:05:55 -08:00

28 lines
848 B
Go

// Copyright 2026 LiveKit, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package service
import (
"context"
"net/netip"
"testing"
)
func SetLookupNetIP(t *testing.T, fn func(ctx context.Context, network, host string) ([]netip.Addr, error)) {
prev := lookupNetIP
lookupNetIP = fn
t.Cleanup(func() { lookupNetIP = prev })
}