For both of those, you can put them through some chromatography/spectrography/etc. and figure out essentially what's in them — what ingredients, in what ratios. What you won't find out is the particular process required to get those ingredients "formatted" the right way to taste like the result.
(E.g. Coke apparently does some fancy, hard-to-replicate-at-home kind of micronized emulsification to the flavoring oils that go into it, to get them into suspension in a water-based drink in a way that results in a smooth—but not viscous or lingering—mouth-feel. That process doesn't change what's in Coke; it just changes how it's in there.)
Also, in both of those cases, FDA inspectors know not only the what but also the how, as they check the manufacturing process to ensure that they're putting in what they (privately) claim to be putting in, no more and no less. And we can then trust the FDA to not let them put anything too "weird" in there, while they can also trust the FDA to not tell everyone what they know about the process.
When I was in college in the 70's we went to a Miller brewery where they told us about some blue liquid they poured into Miller High Life that allowed them to ship the beer in clear bottles instead of brown. It came in tanker cars full; they claimed the FDA didn't know what it was (don't think I believed them).
I don't know what they used in the seventies, but now they use hop oil extract. The extraction process eliminates the possibility of the skunking/lightstruck reaction. Most colorless glass bottled beer use that today, though not all. The green bottle beers mostly don't, though they're still susceptible to skunking.