How could you make sure that closed-source code follows our laws? That it has no back doors for spying and sabotage, and that social media feed shaping algorithms have no bias and shadow-censorship for mass manipulation? You can't, you need to ban it.
You're still living in the 1990s? Using your argument: How do you make sure my server running all open source is not breaking the law? You can't, therefore you must ban that too.