Something isn't legal just because it was passed by the legislature and the President.
A table of federal, state, and local laws held unconstitutional by the Supreme Court.
constitution.congress.gov
The CBP teams were operating away from federal property and out of their jurisdiction, they've admitted to violating constitutional rights.
Federal, as well as state, and local powers are all subject to the constitutional rights every Ametican has. Whether they've committed a crime or not, even then they're innocent until proven guily as supported by the 5th and 14th amendements for due process.