The Gemara (Nida 17b) states that one should not consume onions, garlic or eggs which were exposed and left out all night. The Gemara explains that evilspirits (“Ruah Ra’a”) are attracted to such foods when left out and this poses a danger to one who consumes it. Interestingly, this ruling is not codified in the Shulhan Aruch as Halacha, and Rabbi Moshe Malka (Mikve HaMayim, vol. 3, Yore De’ah, §16) writes that the general practice is to be strict only regardingthose laws of evil spirits which are codified in the Shulhan Aruch. Nevertheless, there are those who are careful not to eat such exposed foods and indeed Rabbi Haim Halberstam of Sanz (Divre Haim, Yore De’ah § 31) writes that many grave illness are the result of consuming foods that draw evil spirits.
Practically speaking, this may come into play when bakeries crack eggs and leave them exposed in a bowl overnight in the refrigerator for use the next day. Rabbi Moshe Shternbuch explains that in this case, spices are usually added to the eggs, which negates the effect of evil spirits. Mixing them with another dish also has the same effect. Cooking such foods, however, does not remove the evil spices. Regarding garlic or onion powder and the like, Rabbi Moshe Feinstein (Igrot Moshe, vol. 3, Yore De’ah, § 2) rules leniently because the Gemara’s ruling was very specific about onions, garlic and eggs themselves, and is not applied to processed derivatives of these foods.
Summary: One should be careful regarding certain foods which are leftout overnight. Adding spices or mixing them with other foods negates the evil spirits.