In the US it's legal, and is considered operating as a sole proprietor. But in doing so, there's no separation between you and the business, and you (and your personal assets) are 100% on the hook for any legal or liability issues that come up.
For that reason alone, I set up an LLC and route all consulting/moonlighting work and side projects through that LLC. The hassle and business licensing costs worked out as far cheaper than operating as a sole proprietor and getting the necessary insurance coverages to comfortably cover myself.
Although it depends on what your SaaS is, you may want to at least checkout a professional indemnity insurance policy[1].
[1] https://www.simplybusiness.co.uk/insurance/faq/what-is-profe...