Sunroofs are not made to seal the glass to the body. They are not leak proof, they are leak resistant. That is why it has four drains, one in each corner. There is a trough all the way around the roof at the glass edge to catch the water that is SUPPOSED to get by the glass to body gap. It is then channeled to the corners where it is drained to the ground.
First open the glass all the way. Get a 32 oz. paper cup. Fill it half full with water. Pour it slowly into the trough at each of the four corners. Before you do it look at how the trough and drains are constructed so you don't pour it inside the truck and headliner. The water should come out QUICKLY at the rear of the inner fenders and behind the cab. If it does not come out, or comes out slow that drain is plugged.
The rear drains have a "flapper" end on them that sometimes sticks closed. Check that first if the rear(s) don't drain quickly enough. If it does drain quickly then check the drain nipple to hose connection at the corner(s) as they sometimes crack the plastic and leak. If it is leaking on the rear of the headliner (or out of the DVD) and the drains are open, the rear trough to side trough connection is cracked and you will need a new sunroof assembly.
I worked on a Jeep a few years ago that was two years old and it was missing the right front drain hose. The customer must have parked it inside its whole life.