They use machine learning to see which code patterns follow other code patterns and then make suggests based on that. "Oh, I see you've written X. Most people who write X follow it with Y."
However, this requires reading people code that they upload to their servers. See their privacy policy here: https://kite.com/privacy.
You just need to compromise their database and you should have access to plenty of source code running around, possibly with secrets/credentials etc - a disneyland for bad guys.
However, this requires reading people code that they upload to their servers. See their privacy policy here: https://kite.com/privacy.