It is in general haram not to observe a rightious treaty (as long as it is possible).
It is also in some cases haram to impose a treaty with unnecessary conditions. Some states forbid such clauses in their civil law. If these conditions are not permissible by the civil law of your country, it is evident that this part of the treaty is invalid and you need not observe it.
Shari'ah based judisprudence would decide on this individual case on the base whether this is a valid interest.
In practice, the case would be decided under the applied law of your state; if a decision is already made under civil law, it would not be challenged in Shari'ah law. So read your civil law.
A fatwa on this subject (not your particular case) is published here.