Rule #63 of home inspections: If anyone *can* do their own electrical wiring, anyone *will* do their own electrical wiring. Especially with Home Depot and Lowes there to encourage them.
This light fixture is intended to be installed over a flush-mount electrical box. (That’s a box that fits inside the wall and is flush with the surface of the wall – or better, yet, of a mounting block.) In this picture, someone installed the fixture over a surface-mount box. The joint between the two isn’t water-tight and can’t be made water-tight.