lib/model: Don't share with introduced device if encrypted (fixes #7724) (#7734)

This commit is contained in:
Simon Frei
2021-06-03 15:02:57 +02:00
committed by GitHub
parent df48276300
commit 004eded398
2 changed files with 18 additions and 1 deletions
+13 -1
View File
@@ -518,12 +518,18 @@ func TestIntroducer(t *testing.T) {
},
},
})
cc := basicClusterConfig(myID, device1, "folder1")
cc := basicClusterConfig(myID, device1, "folder1", "folder2")
cc.Folders[0].Devices = append(cc.Folders[0].Devices, protocol.Device{
ID: device2,
Introducer: true,
SkipIntroductionRemovals: true,
})
cc.Folders[1].Devices = append(cc.Folders[1].Devices, protocol.Device{
ID: device2,
Introducer: true,
SkipIntroductionRemovals: true,
EncryptionPasswordToken: []byte("faketoken"),
})
m.ClusterConfig(device1, cc)
if newDev, ok := m.cfg.Device(device2); !ok || !newDev.Introducer || !newDev.SkipIntroductionRemovals {
@@ -534,6 +540,12 @@ func TestIntroducer(t *testing.T) {
t.Error("expected folder 1 to have device2 introduced by device 1")
}
for _, devCfg := range m.cfg.Folders()["folder2"].Devices {
if devCfg.DeviceID == device2 {
t.Error("Device was added even though it's untrusted")
}
}
cleanupModel(m)
cancel()
m, cancel = newState(t, config.Configuration{