Probably the microscopic onion eelworm (causes onions to rot in storage,
according to the RHS book on pests & diseases), though it could be the
maggot of the onion fly, which you would see; but it could be any number
of other causes, such as a simple mould or "rot".
I'm sure the non- soft parts of eelworm infected onions would do you no
harm, cooked. Unless your a vegetarian ;-)
(cross- posted for informed comment)
--
Andy Mabbett
"If they censure you, they tell you to cut it out.
If they censor you, they just cut it out."