Is cooking in plastic bags safe?

Yes, so long as the ingredients are cooked in food-grade Polyethylene, BPA free bags.

Most recognised food storage bags are made from Polyethylene and so should be safe for sous vide cooking. Vacuum pouches specifically designed for sous vide cooking are also safe and are used more commonly in a professional setting.