In 2016, US Customs and Border Patrol (CBP) performed border searches on approximately 19,000 electronic devices, both inbound and outbound. In 2017, CBP searched approximately 30,000 electronic devices, which is roughly 60% more searches. See CBP post.
You might think the Fourth Amendment's prohibition on unreasonable searches and seizures and requirement for a warrant or probable cause for a search might apply. See link. However, at an international border (or its functional equivalent such as an airport), the US government's interests are greater than an individual's right to privacy. Thus, the balance favors the government's interests and routine searches are considered reasonable (meaning no warrant is needed).
Because electronic devices contain so much information -- both personal and work, there are concerns about warrantless border searches. For example, an employee of NASA's Jet Propulsion Laboratory was pressure to turn over the PIN code to his NASA-issued phone which would have compromised classified information. See link to story. Because of these stories and the nature of the information on electronic devices, Congress has proposed requiring a warrant before such a search could occur. See link to story.
Given the increased number of warrantless border searches, there have been concerns about searches of an attorney's electronic devices. A demand for such a search could lead to a breach of attorney-client privileged or attorney work-product materials. In July 2017, the New York City Bar released an ethic's opinion describing how any attorney could meet his ethical obligations to protect client confidential information when crossing the border. See NYC Bar Ethics Opinion.
In light of the increased scrutiny of border searches, in January 2018, the CBP updated its border search policy (click link to download) and issued an updated Privacy Impact Assessment (click link to download). Section 5.2 of the updated policy specifically addresses the review and handling of privileged materials.
If your device is subject to search, you should assert privilege which will trigger certain procedures. Although an assertion of privilege won't stop the search, it will provide some additional protections to prevent the disclosure of privileged materials.
Finally, as per the NYC Bar Ethics Opinion, if your device is searched, you may have an ethical obligation to notify each client's whose confidential information was searched.
Image from PixaBay under CC0.