I have a confusing legal question. We all know ex post facto laws are illegal in the US - that means you can't prosecute someone for doing X, if X was legal at the time (but later criminalized). Now, suppose X is illegal, and someone (let's call him Borgé Gush) does X. Later, Congress passes a law legalizing X and granting retroactive immunity for anyone who commited X in the past. Can Congress even rescind the immunity and legality, i.e., will Borgé ever worry about being prosecuted for his illegal act? Or would that be ex post facto? How does it work?