Ex Post Facto
To answer Atrios’s question, the constitutional prohibition on ex post facto laws has been held to apply principally to criminal, not civil, cases. Also, the implicit purpose of the provision is to act as a constraint on the state’s power to punish the individual by retroactively criminalizing acts; state action that exempts individuals (or corporations) from punishment or liability doesn’t really apply.
More importantly, of course, immunizing corporations who assisted the government in illegal acts regardless of the facts is certainly appalling even if it’s constitutional.