Cherry-pick PR into `main` from https://github.com/fleetdm/fleet/pull/34932 that targeted 4.76.0
main