Plug a new USB stick, SD card or Thunderbolt dock into a Mac laptop with Apple silicon and you get an alert asking whether to allow it. That alert has a setting behind it, and I think most people never notice they can change it.
It lives here:
System Settings > Privacy & Security > Accessories > Allow accessories to connect
The menu has four choices. “Always ask” wants your approval every time anything connects. “Ask for new accessories” only asks the first time, and that’s the default. “Automatically allow when unlocked” approves accessories as long as the Mac is unlocked, and “Always allow” approves everything.
On my MacBook Pro I’d stick with the default at home and consider “Always ask” for travel. A charging cable at a hotel desk or someone’s “I’ve got the files on a stick” then always needs a click from you. I wouldn’t pick “Always allow” on a laptop; the point of the prompt is that a locked Mac doesn’t talk to whatever someone plugs into it.
If your Mac is locked, you have to unlock it before you can allow an accessory. After three or more days locked, you may have to unlock it again even for an accessory you allowed before. Click Don’t Allow and the Mac won’t recognize the accessory at all; it asks again next time you plug it in. If you run your laptop closed on a dock, allow the display, mouse and keyboard first, with the lid open.
Further reading: Allow USB and other accessories to connect to your Mac