I had written a blog post on this in 2011. You can see it here.
Recently, the OU in their emails sent the following:
May I dice onions and place them in sealed packaging to avoid the sakana (danger) of eating peeled onions that were left overnight?
(A subscriber’s question)
The Gemara (Nida 17a) writes that there is a sakana to eat peeled onions that were left overnight, even if they were placed in sealed packaging. The only exception that the Gemara mentions is if part of the roots or the peel is left on the onion. Tosfos (Shabbos 141a s.v. Hani) writes that the sakana applies to diced onions as well. However, if there are other ingredients mixed in to the onions, Rishonim already discuss that one can be lenient. Igros Moshe (Y.D. III: 20) writes that industrial produced products are not subject to this sakana. So one may purchase frozen packages of diced onions.
as well, the OU wrote:
Q. Does the halacha of not eating onions which were peeled and left overnight apply to the following: red onions, white onions, scallions, shallots and leeks? (A subscriber’s question)
A. Rav Belsky, zt”l said the halacha applies to both red and white onions and shallots, but not to leeks and scallions.
I sent my article to the OU for their feedback. It was sent onto the Safra D’Dayna Rabbi Eli Gersten, who responded that:
You are correct that the topic of ru’ach ra’ah is certainly unclear.
I don’t have an explanation as to why earlier poskim (Shulchan Aruch, Maharshal, Rema…) where seemingly unconcerned about this type of ruach ra’ah and yet later generations again began to be choshesh.
Rabbi Yosef Grossman of the OU offered to send me an article from the Daf Hakashrus of 2005 on the topic, which I copy below. I am chuffed that my thoughts were somewhat aligned with Mori V’Rabbi R’ Hershel Schachter שליט׳א (though I didn’t know of him in 2005).