https://continuations.com/post/624305968188145664/help-stop-...
There the relevant law is quoted and explained.
So, in short, the DHS has the FPS (Federal Protective Service), and their job is
> "... safeguarding Federal owned and leased facilities and has been since 1790.
The FPS is part of the DHS.
...
The Customs and Border Protection unit is legally supporting the Federal Protective Service because the particular unit -- the Border Patrol Tactical Unit -- BORTAC -- is highly trained in riot control operations."
There are lots more details by JLM there including quotes of the relevant laws, e.g., 40 USC 1315.
So, the FPS was in Portland to protect Federal property as in 40 USC 1315.
In simplest terms, the Federal work there in Portland was protecting Federal property. Policing Portland in general was not part of the work.
The article mentioned "secret police": To set that aside, just read the JLM quotes and explanations of the laws.