here is the breakdown of what customs can do at ports of entr...
it's from the ACLU so it's geared to be helpful.
(like, can they search my dvices? yes with lots more info... questions like can they do a strip search? etc IMO serve as a reminder of how far customs can go, if they want to)
and scrolling to the bottom of that link, will get you another link to the Traveler's Bill of Rights as well.
https://www.aclunc.org/our-work/know-your-rights/know-your-rights-us-airports-and-ports-entry