A proper fix is not to shell out to a command at all; use getpwnam(3) or similar.
Still, requesting the information from systemd-userdb would be a better way of doing this if it's really necessary.
EDIT: Yeah, some older comments confirm that was their reasoning. https://github.com/tailscale/tailscale/commit/1fc1077052dfa7...