If you want a really rigorous proof, then the answer is that it is in fact not true that light rays have $ds^2 = 0$, because in a curved spacetime there is no general notion of a light ray.
What you would have to do is solve Maxwell's equations in a curved background; assuming that the typical length scale of the field (so the wavelength) is much smaller than the length scale of spacetime curvature you get something like the wave equation, and you can pretend your wave is a light ray. If you do this it turns out that the wave four-vector $k^\mu$ of this wave/ray must be null ($k_\mu k^\mu = 0$), which is the same as saying that $ds^2 = 0$ along the ray. For some insight into the subtleties of this, see for example this post.
However, there is another way of getting at this if you're willing to accept that in special relativity there is such a thing as a light ray. The argument rests on the fact that every manifold is locally flat; to put in physics words, in a curved spacetime you can choose coordinates near a point so that the metric is that of SR to first order, and is exactly the Minkowiski metric at your chosen point. You simply say that in these particular coordinates $ds^2 = 0$, and since $ds^2$ is a scalar, it will be zero no matter what system of coordinates.
There is a conceptual distinction which can be made here, which is that of speed of light vs. the speed of causality. The latter is the maximum speed at which things can travel, and almost by definition the maximum speed paths are those with $ds^2=0$; this is because the very structure of relativity enforces this speed limit. It just so happens that light travels at this maximum speed (particle physicists will mention the masslessness of the photon at this point), but there's no fundamental reason it must do so.