From f1ad26f694c1dddf0a9b6ef30a52eaae995331ab Mon Sep 17 00:00:00 2001 From: Maisem Ali Date: Sat, 19 Nov 2022 00:23:57 +0500 Subject: [PATCH] ipn/ipnlocal: strip NetworkLockKey from Prefs Signed-off-by: Maisem Ali --- ipn/ipnlocal/local.go | 1 + ipn/ipnlocal/state_test.go | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 849a57b49..8ea234d38 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -523,6 +523,7 @@ func stripKeysFromPrefs(p ipn.PrefsView) ipn.PrefsView { p2.Persist.LegacyFrontendPrivateMachineKey = key.MachinePrivate{} p2.Persist.PrivateNodeKey = key.NodePrivate{} p2.Persist.OldPrivateNodeKey = key.NodePrivate{} + p2.Persist.NetworkLockKey = key.NLPrivate{} return p2.View() } diff --git a/ipn/ipnlocal/state_test.go b/ipn/ipnlocal/state_test.go index 8a1653fe2..3ff1fcf72 100644 --- a/ipn/ipnlocal/state_test.go +++ b/ipn/ipnlocal/state_test.go @@ -973,20 +973,21 @@ func TestEditPrefsHasNoKeys(t *testing.T) { t.Errorf("Hostname = %q; want foo", p.Hostname()) } - // Test that we can't see the PrivateNodeKey. if !p.Persist().PrivateNodeKey.IsZero() { t.Errorf("PrivateNodeKey = %v; want zero", p.Persist().PrivateNodeKey) } - // Test that we can't see the PrivateNodeKey. if !p.Persist().OldPrivateNodeKey.IsZero() { t.Errorf("OldPrivateNodeKey = %v; want zero", p.Persist().OldPrivateNodeKey) } - // Test that we can't see the PrivateNodeKey. if !p.Persist().LegacyFrontendPrivateMachineKey.IsZero() { 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 {