If it’s to take a brake calliper then a bolt with a recessed nut is what’s needed, as the hole in the back of the crown is bigger than the hole in the front. If it is just to hold a light or mudguard then standard M5 bolt of the correct length is better and a standard locknut, with a washer against the back of the fork. This is because the slot in the tab of the mudguard that attaches it to the back of the fork crown is not usually wide enough to take a recessed nut without widening it so a standard nut is better, and a locknut even better.