Leaving AirDrop open to everyone on a busy train is asking for random pictures from people you’ve never met. I keep my Mac on Contacts Only, and recent versions of macOS make that a lot less annoying when someone outside your contacts does need to send you something.
You set who may send you items from Control Center in the menu bar:
Control Center > click and hold AirDrop (or click the arrow next to it)
> Contacts Only
The other choice is Everyone. The AirDrop icon turns blue when AirDrop is on.
The part I like is new in macOS 26.2 (and iOS 26.2 and iPadOS 26.2). When someone who isn’t in your contacts tries to send you a file, they have to use an AirDrop code. Say a colleague at a meetup wants to send you a PDF. You choose Continue, click Get AirDrop Code, read the code out, and they type it in on their device. After that the two of you can AirDrop each other for 30 days without another code.
The caveat is that those 30 days are easy to forget. If you’d rather end it sooner, open the Contacts app, find the person in the Other Known list and choose Forget This Person. Also keep in mind where things land: on a Mac, some received items go straight into your Downloads folder, and items sent between devices on your own Apple Account are accepted automatically without a prompt.
Further reading: Use AirDrop on your Mac (Mac User Guide)