Ubuntu: how to tell which application is asking for permissions when prompted

In ubuntu 20 I get prompted to enter my password for some mystery application frequently. I write services across root and userspace and need at least a PID or name to have even a notion whether the application should get permissions to keyrings. Why ask in the first place?