I was wondering if any could give me some pointers on the issue of having students working on software that's being developed in the lab. What's the standard procedure on this issue? Is there some sort of agreement that's better for the student to sign before he/she starts contributing to this software? Are there any standard conditions that I can use to set up the agreement?
By and large, taught students (ie, ones who are not paid a stipend or salary) by default retain the copyright to their own work (in contrast to employees, who generally agree to assign it to whoever they are working for). Therefore, you should probably have then sign an agreement to assign the copyright to the lab or university, and you should certainly do this before they do any work. This will ensure you can continue to do what you want with the source code without having to ask permission from the students in question.
For research students, it varies from country to country, so the copyright on their work may be assigned to them, or it may be assigned to the university. If it is already assigned to the university, you don't need to do anything else.
You should probably speak to your university's legal department about this and especially if you do need to write up a contract to assign the university copyright. You may also find this question on programmers.se useful.