Are accidentally fermented foods safe to eat I grew tomatoes this year and then made sauce out of them about 3 weeks ago (tomatoes, onion, garlic, basil, olive oil, salt).  When I opened the jar I heard the distinct sound of C02 releasing.  I looked in the jar and saw a good amount of bubbling. No visible mold in the jar.  It doesn't smell bad, just fermented.

I've made a variety of pickled and fermented foods before and never had a problem eating those.  Kimchi comes to mind as a similar food where the fermentation comes without adding any starters, just salt, cabbage, and spices.  For some reason the fact that i didn't intend to ferment the sauce is making me second guess eating it.  Is it possible to use salt/vinegar to kill off any bad bacteria lingering in the sauce? What if I were to convert the sauce into a fermented ketchup?
Do.
Not.
Eat. 

The assumption that it fermented enough to be safe because it fermented some is likely incorrect. Lacto fermented food recipes are specifically formulated to encourage the rapid and significant growth of lactic acid producing bacteria which lowers the ph so quickly that it overwhelms pathogens which are also trying to grow. Even then, consuming lacto fermented vegetables before they hit a ph level of 4.6 is still not safe. Almost no tomato sauces would be acidic enough to discourage pathogen growth on their own. 

Even if the lactic acid in the sauce slowly built up enough to kill all of the live pathogens with acid alone, many food pathogens create toxins (Shiga, Botulism Toxin, etc,) and those could still harm or kill you, even if you heated the sauce up to serving temperature. Though botulism toxin can be neutralized by boiling for some amount of time, after looking around for a bit, I haven't seen anything that guarantees Shiga or other common toxins do too. Is it worth it? 

There are lots of pathogens which thrive in that very environment, and plenty that produce gas as waste. You don't know what was growing in there, or what it left behind.