tailscale/ipn/store
kari-ts 7355116c05
ipn/store: make WriteState(id, nil) delete key instead of adding nil entry (#19920)
All StateStore implementations store a nil value in the cache map when WriteState is called with a nil byte slice instead of deleting the key. This causes ReadState to return (nil, nil) instead of (nil, ErrStateNotExist), since the key is still present in the map.

This breaks reset-auth in Windows, Linux, and Android, and the node can't log back in without manually editing the state file. (macOS uses a different state store)
DeleteProfile, DeleteAllProfilesForUser, setUnattendedModeAsConfigured are impacted but don't seem to break because the deleted keys are not reread.

This deletes the key from the cache instead.

Fixes tailscale/corp#42477

Signed-off-by: kari-ts <kari@tailscale.com>
2026-05-29 11:22:14 -07:00
..
awsstore all: use Go 1.26 things, run most gofix modernizers 2026-03-06 13:32:03 -08:00
kubestore ipn/store: make WriteState(id, nil) delete key instead of adding nil entry (#19920) 2026-05-29 11:22:14 -07:00
mem ipn/store: make WriteState(id, nil) delete key instead of adding nil entry (#19920) 2026-05-29 11:22:14 -07:00
stores_test.go ipn/store: make WriteState(id, nil) delete key instead of adding nil entry (#19920) 2026-05-29 11:22:14 -07:00
stores.go ipn/store: make WriteState(id, nil) delete key instead of adding nil entry (#19920) 2026-05-29 11:22:14 -07:00