Pretty much any software project of any size should require explicit agreements of who the copyright goes to. Even if there are no issues with one trying to pull some stunt like this, minor stuff comes up all the time about exactly what license is going to be used for the code and the off chance of wanting to change licenses or have the code under multiple licenses in the future. The agreement can be as simple as just telling all contributors they can only contribute if they release under some specific open source license.
Pretty much any software project of any size should require explicit agreements of who the copyright goes to. Even if there are no issues with one trying to pull some stunt like this, minor stuff comes up all the time about exactly what license is going to be used for the code and the off chance of wanting to change licenses or have the code under multiple licenses in the future. The agreement can be as simple as just telling all contributors they can only contribute if they release under some specific open source license.