kolide / launcher

Osquery launcher, autoupdater, and packager
https://kolide.com/launcher
Other
501 stars 99 forks source link

InModernStandby should not persist across launcher restarts #1718

Closed zackattack01 closed 1 month ago

zackattack01 commented 1 month ago

We currently cache a boolean flag (InModernStandby) for windows devices to expose the power state through knapsack. If the device shuts down from an InModernStandby state, that value will be cached within bbolt and read after boot.

This will happen before the power_event_subscriber could possibly be aware of the new state changes, and leave launcher out of sync with the device state. We use this state to pivot restart/healthcheck behavior for the desktop process (amongst other things), which can result in us skipping the MBA initialization entirely on boot.

One quick and easy way to avoid this would be to clear the cached state on launcher startup, assuming we are not being started from a sleeping state and giving the power_event_subscriber a chance to get us back in sync.