Where did you et that idea? Congress can legislate anything they want to, even legislation that the Court can have no say over.
On the off chance that your question is serious, I offer the Constitution as the source of my idea. Article 1, Section 8 to narrow it a bit for you.
If you have not received instruction, regarding the founding of the country the Constitution may confuse you. Let me provide some clarification.
There are two major things to know about the Constitution.
The first is that the Constitution is not about the people. The Constitution is solely about how government is to function.
The second things is that Congress only has the specific legislative powers granted in article 1, Section 8.
Madison in Federalist No. 45: The powers delegated by the proposed Constitution to the federal government are few and defined. Those which are to remain in the State governments are numerous and indefinite.
Perhaps there is more appeal in presenting it in more modern terms.
How to Configure a Packet Filter - General rules - least privilege
All that is not expressly permitted is prohibited
In a nutshell, if the Constitution does not specifically say they can legislate then they cant.
You will not find the power to legislate marriage, abortion, or flag burning among the enumerated powers.