mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-20 07:21:27 +02:00
* Updates rosenpass version go-rosenpass v0.4.0 → v0.5.42 bump — detailed findings Change summary cunicu.li/go-rosenpass v0.4.0 → v0.5.42 (target) cilium/ebpf v0.15.0 → v0.19.0 (transitive) gopacket/gopacket v1.1.1 → v1.4.0 (transitive) wireguard 2023-07 → 2023-12 (transitive) wireguard/wgctrl 2023-04 → 2024-12 (transitive) Wire interop v0.4.0 (in v0.70.5) <-> v0.5.42 OK v0.5.42 <-> v0.5.42 OK Quantum resistance: true both ends --- **Replay error eliminated.** Before (on v0.4.0): `ERROR Failed to handle message: failed to load biscuit (ICR1): detected replay` Recurring every ~50ms for minutes at a time. Gone entirely after both ends upgraded to v0.5.42. Upstream fix in biscuit/replay handling between v0.4.x and v0.5.x series. * Fixup [::]:port socket trying to send to v4 * Adds more tests on netbird<->rosenpass interactions * Anticipates rp handler creation before generateConfig * [client] Moves deterministic key gen into rosenpass * go mod tidy * Adds reminder to reason about rosenpass surface area * Apply code rabbit suggestions
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
package rosenpass
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestDeterministicSeedKey_SameForBothSides(t *testing.T) {
|
|
// Peer A and peer B must derive the same PSK regardless of which side
|
|
// computes it: the function orders inputs internally.
|
|
a := strings.Repeat("a", 32)
|
|
b := strings.Repeat("b", 32)
|
|
|
|
keyAB, err := DeterministicSeedKey(a, b)
|
|
require.NoError(t, err)
|
|
keyBA, err := DeterministicSeedKey(b, a)
|
|
require.NoError(t, err)
|
|
require.Equal(t, keyAB.String(), keyBA.String(), "swapping arguments must yield identical key")
|
|
}
|
|
|
|
func TestDeterministicSeedKey_ChangesWithKeys(t *testing.T) {
|
|
a := strings.Repeat("a", 32)
|
|
b := strings.Repeat("b", 32)
|
|
c := strings.Repeat("c", 32)
|
|
|
|
keyAB, err := DeterministicSeedKey(a, b)
|
|
require.NoError(t, err)
|
|
keyAC, err := DeterministicSeedKey(a, c)
|
|
require.NoError(t, err)
|
|
require.NotEqual(t, keyAB.String(), keyAC.String(), "different peer pair must yield different key")
|
|
}
|
|
|
|
func TestDeterministicSeedKey_TooShortKey_ReturnsError(t *testing.T) {
|
|
short := "short" // < 16 bytes
|
|
long := strings.Repeat("x", 32)
|
|
|
|
_, err := DeterministicSeedKey(short, long)
|
|
require.Error(t, err)
|
|
_, err = DeterministicSeedKey(long, short)
|
|
require.Error(t, err)
|
|
}
|
|
|