Is Apple magic keyboard secure against man-in-the-middle attacks when it pairs to mac automatically? Recently I heard lots of wireless keyboards are vulnerable to eavesdropping. I don’t want my key strokes to be captured by drones.
Regardless of the specific keyboard model you asked, the range for wireless functionality is way less than what a drone could eavesdrop. You use the magic keyboard indoors, so there's no point in talking about drones.
Anyways, I recommend this Hacktivity presentation to get a closer glimpse about how wireless keyboard exploits work. https://www.youtube.com/watch?v=JPaiqJIMFCU
Apple keyboards use Bluetooth. When using MacOS, the keyboard will automatically pair, and be checked against a list of trusted keyboards. If it's not there, a code will be displayed on the screen to be entered on the new keyboard. If entered, it will be marked as trusted, and input from it will be accepted.
Bluetooth itself is encrypted. While your connection is susceptible to being MITM'd, encryption prevents eavesdropping.
Eavesdropping and man in the middle are two different things. Is it secure against someone listening from the window one day with only a receiver (eavesdropping)? Maybe a little bit. It sounds like there is some pairing process that you need physical access to the mac which is good, but it's Bluetooth which is bad.
Is it secure against a man in the middle attack? Where someone somehow receives the signal from the keyboard, and then sends it on to the Mac? Nope, but to set that up they would hopefully need physical access to set it up anyway.
So I would say safe from drones, unless they are really nerdy drones, or the type of drones that are allowed inside your house.