I am pretty sure you can’t pass legislation aimed at one person. It was a SCOTUS ruling way back when.
Can someone check me on that?
You are speaking of a "bill of attainder", and it is, indeed, unconstitutional, but to be invalidated it must be shown that one, and only one, individual would ever be affected.
"All candidates" is obviously more than one person.