ipn/ipnlocal: strip NetworkLockKey from Prefs

Signed-off-by: Maisem Ali <maisem@tailscale.com>
pull/6069/head
Maisem Ali 2 years ago committed by Maisem Ali
parent f40bb199f5
commit f1ad26f694

@ -523,6 +523,7 @@ func stripKeysFromPrefs(p ipn.PrefsView) ipn.PrefsView {
p2.Persist.LegacyFrontendPrivateMachineKey = key.MachinePrivate{} p2.Persist.LegacyFrontendPrivateMachineKey = key.MachinePrivate{}
p2.Persist.PrivateNodeKey = key.NodePrivate{} p2.Persist.PrivateNodeKey = key.NodePrivate{}
p2.Persist.OldPrivateNodeKey = key.NodePrivate{} p2.Persist.OldPrivateNodeKey = key.NodePrivate{}
p2.Persist.NetworkLockKey = key.NLPrivate{}
return p2.View() return p2.View()
} }

@ -973,20 +973,21 @@ func TestEditPrefsHasNoKeys(t *testing.T) {
t.Errorf("Hostname = %q; want foo", p.Hostname()) t.Errorf("Hostname = %q; want foo", p.Hostname())
} }
// Test that we can't see the PrivateNodeKey.
if !p.Persist().PrivateNodeKey.IsZero() { if !p.Persist().PrivateNodeKey.IsZero() {
t.Errorf("PrivateNodeKey = %v; want zero", p.Persist().PrivateNodeKey) t.Errorf("PrivateNodeKey = %v; want zero", p.Persist().PrivateNodeKey)
} }
// Test that we can't see the PrivateNodeKey.
if !p.Persist().OldPrivateNodeKey.IsZero() { if !p.Persist().OldPrivateNodeKey.IsZero() {
t.Errorf("OldPrivateNodeKey = %v; want zero", p.Persist().OldPrivateNodeKey) t.Errorf("OldPrivateNodeKey = %v; want zero", p.Persist().OldPrivateNodeKey)
} }
// Test that we can't see the PrivateNodeKey.
if !p.Persist().LegacyFrontendPrivateMachineKey.IsZero() { if !p.Persist().LegacyFrontendPrivateMachineKey.IsZero() {
t.Errorf("LegacyFrontendPrivateMachineKey = %v; want zero", p.Persist().LegacyFrontendPrivateMachineKey) t.Errorf("LegacyFrontendPrivateMachineKey = %v; want zero", p.Persist().LegacyFrontendPrivateMachineKey)
} }
if !p.Persist().NetworkLockKey.IsZero() {
t.Errorf("NetworkLockKey= %v; want zero", p.Persist().NetworkLockKey)
}
} }
type testStateStorage struct { type testStateStorage struct {

Loading…
Cancel
Save