Question: I was most surprised when my wife told me that I shouldn’t have left half an onion in the fridge overnight. What are the criteria of this halacha and what should I do with the onion?
Answer: The Gemara (Nidda 17a) writes that it is dangerous to leave peeled garlic, onion or egg overnight due to ruach ra’ah, evil spirit.
This halacha only applies if the entire onion, garlic or egg is peeled. However, if part of it remains unpeeled, or if it has already been mixed with any other food, it may be eaten (Kaf Hachaim OC 504:1; YD 116:92). Some, therefore, add salt to remove this prohibition (See Tzitz Eliezer 18:46; Minchas Yitzchak 6:75).
There is a machlokes as to whether cooking it helps. The Darkei Teshuva (116:74) and R’ Shmuel Wosner (Shevet Halevi 3:169) write that it doesn’t apply once it’s been cooked, though other poskim hold that it is only a problem when cooked (See Minchas Yitzchak 4:108).
There is a further machlokes as to whether commercial cooks and bakers need to be concerned for this. While the Klausenberger Rebbe (Divrei Yatziv YD 1:31) and Chelkas Yaakov (3:YD 39) rule stringently, the consensus of poskim is to be lenient (Igros Moshe YD 3:20; Shevet Halevi 3:169; 6:11; Minchas Yitzchak 2:68; Yabia Omer YD 2:7).
While R’ Ovadia Yosef (Yabia Omer YD 2:7) allows such foods that were left overnight to be eaten, others (Chelkas Yaakov YD 39) write that they should be discarded (See Minchas Yitzchak 2:68; 9:28).
This halacha is not mentioned in the Rif, Rambam or the Shulchan Aruch and even some later poskim including the Pischei Teshuva and Kitzur Shulchan Aruch, likely because they held that this evil spirit no longer exists (See Lechem Mishne, Hilchos Shevisas Asor 3:2; Teshuvos Pri Hasadeh 3:61).
Nonetheless, it is mentioned by many of the poskim including the Rosh (Betzah 1:21), Pri Chadash (116), Shulchan Aruch Harav (Shemiras Haguf Vehanefesh 7) and Aruch Hashulchan (YD 116:22).
There is, therefore, a machlokes as to whether one who hasn’t kept this halacha needs to at all. The Darkei Teshuva (116:74) quotes sources on both sides, though R’ Moshe Feinstein (YD 3:20), R’ Yitzchok Weiss (Minchas Yitzchak 2:68:13), R’ Ovadia Yosef (Yabia Omer YD 2:7) both write that one should ideally observe this custom.