Provisions in public works contracts with public entities which provide that acceptance of a payment otherwise due a contractor is a waiver of all claims against the public entity arising out of the work performed under the contract or which condition the right to payment upon submission of a release by the contractor of all claims against the public entity arising out of performance of the public work are against public policy and null and void. This section shall not prohibit a public entity from placing in a public works contract and enforcing a contract provision which provides that payment of undisputed contract amounts is contingent upon the contractor
furnishing the public entity with a release of all claims against the public entity arising by virtue of the public works contract related to those amounts. Disputed contract claims in stated amounts may be specifically excluded by the contractor from the operation of the release.