Nice senseless phrasing, but there is no consumer boycott that is illegal.
38 out of 50 states have laws on their books prohibiting Israeli product boycott and some form or another.
In the most egregious cases, these do things like fire School teachers if they are choosing to avoid Israeli products in their personal life.
https://en.m.wikipedia.org/wiki/Anti-BDS_laws
Read the constitutional challenges for some examples...
Is there a law that prohibits individuals who are not operating under such a contract from boycotting?
I would however clarify your statement in that the scope often extends not just to the work under contract, but personal and professional behavior outside the scope of contract.