when you commit code to a project you are warranting that you have the legal right to do so. the bigger projects will not even accept your contribution done at work without an explicit permission from your employer.
this is not just about you and your risk, but also about the risk for the project.
this is not just about you and your risk, but also about the risk for the project.