Here in the UK, for example, if you wrote such a contract, it would be enforceable… but you would be considered (by the tax authority) to be trying to evade employment taxes, and hit with something starting in the range of a low 5-figure financial consequence (assuming the contract was a few months at current average rate for tech workers).
All of my contracts explicitly allow subcontracting in order to comply with tax law.
I realize this thread is full of armchair lawyers, but that is definitely not the case in the US.
Most importantly, there are plenty of valid business reasons to prevent subcontracting that don't have to do with "locus of control" issues that would warrant someone being a full-time employee.
There's also an issue of 'what you bought' - this isn't necessarily a contractual thing. I work for a consultancy, if we sell you a project based on the skills and knowledge of a few of our experts and then when the project starts we actually staff the project with a few grads, you'd be annoyed right? Very carefully our contracts don't name individuals to allow us flexibility (e.g. someone gets ill, goes on leave etc.) so we're fine legally but you'd be understandably upset and might want to end the contract. [this by the way, is exactly what Accenture does quite a lot]
3. RESPONSIBILITY FOR EMPLOYEES AND SUBCONTRACTORS, INCLUDING AGENCY MEMBERS If a User subcontracts with or employs third parties to perform Freelancer Services on behalf of the User for any Engagement, the User represents and warrants that it does so as a legally recognized entity or person and in compliance with all applicable laws and regulations. Further, at all times a User that agreed to perform services under a Services Contract remains responsible for the quality of the services and represents and warrants that User has entered into agreements with any such employees and subcontractors on confidentiality and intellectual property at least as strong as those in these Optional Service Terms.
it's a business to business agreement. a contractor is free to sub.
https://www.upwork.com/legal#optional-service-contract-terms
They can also include clauses that the company's code and other materials won't be shared with 3rd parties, aka an NDA. These are standard and well-accepted practice.
The contract will also be very clear that access to the systems is only granted to the person signing the contract. They don't get to grant access to other people just because they have contractor status.
I’ve never seen a contracting agreement that didn’t specifically prohibit subcontracting without the explicit written consent of the client. It’s not that it wouldn’t be federally legal, it’s that it would violate the specific contract with the client.