Spooky Security

Eric Bailey

Posted on 7 September, 2018

Tags: darwin, keyboard, security, skhd, chunkwm

Update (21 September, 2018): It turns out Keybase.app was to blame. I've since quit it and removed it from my login items, and all is well again. This skhd issue thread details some excellent debugging strategies, which I've modified slightly here.

ioreg -lw 0 \
    | perl -nle 'print $1 if /"kCGSSessionSecureInputPID"=(\d+)/' \
    | uniq \
    | xargs ps -o comm= -p

For example, when I enable secure keyboard entry in Terminal.app, I see the following output.

/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal

I've been using chunkwm and skhd to help make Darwin more palatable, but skhd suddenly stopped working. When I try to start it manually, I get the following error.

skhd: secure keyboard entry is enabled! abort..

The internet suggested I disable iTerm 2's Secure Keyboard Entry, but I've switched to kitty.

After some further frantic DuckDuckGo-ing, I came across a function, DisableSecureEventInput, which seemed like the answer, so I wrote a quick program to call it and try to end my troubles.

#include <Carbon/Carbon.h>


int main(int argc, const char *argv[])
{
    if (IsSecureEventInputEnabled())
        printf("Secure keyboard entry is enabled.\n");

    DisableSecureEventInput();

    if (IsSecureEventInputEnabled())
        printf("Secure keyboard entry is still enabled.\n");


    return 0;
}
Secure keyboard entry is enabled.
Secure keyboard entry is still enabled.

No such luck. I'm literally dying.