Striping of some env vars such as LD_LIBRARY_PATH, LD_PRELOAD, or HOSTALIASES will happen automatically when calling a suid/sgid binary. I had this issue with xterm recently (sgid utmp) and I see that ssh-agent is mentionned here (sgid ssh).
I don't know if it can easily be implemented in ssh-agent, but vte uses a helper for sgid tasks (/usr/lib/libvte9/gnome-pty-helper) which allows programs such as gnome-terminal to not be sgid.
Striping of some env vars such as LD_LIBRARY_PATH, LD_PRELOAD, or HOSTALIASES will happen automatically when calling a suid/sgid binary. I had this issue with xterm recently (sgid utmp) and I see that ssh-agent is mentionned here (sgid ssh).
I don't know if it can easily be implemented in ssh-agent, but vte uses a helper for sgid tasks (/usr/lib/ libvte9/ gnome-pty- helper) which allows programs such as gnome-terminal to not be sgid.