a leak comes from under dash on passenger side when ac is on but works ok other on 2007 Chevrolet Cobalt

then that.

If it smells or looks like coolant, presure test the cooling system and see if you can see it leaking inside the vehicle while under pressure. If so, the heater core is leaking. If it isn't coolant, then the evaporator drain is plugged up and the condensation is collecting and backing up and coming out of the box inside the car. The evaporator drain plugging is pretty common on those, so I wold say pull off the rubber drain hose under the hood and clean out the drain anyway whether or not you find the heater core leaking. Only takes a few minutes.
where is drain plug and hose specificaly