How do I replace a porch light that’s mounted to a surface-mounted junction box?
Provided there is only 1 cable in that box, I recommend replacing it with a pancake box like this...     https://www.homedepot.ca/product/iberville-ceiling-pan-1-2-in-deep-ko/1000106180
Once the new fixture is mounted and working,  apply caulking to make it weather resistant.