Unconstitutional searches of travelers’ electronic devices, conducted by Customs and Border Protection officials without a warrant based on probable cause, are on the rise. As this issue is litigated, Congress can take steps to stop individuals’ rights from being violated.

On Thursday, I testified in front of the Senate on CBP’s practice of seizing and searching smartphones, laptops, and other electronic devices at the border. At the hearing, members of Congress — including Senators Rand Paul (R-Ky.), Ron Wyden (D-Ore.), and Gary Peters (D-Mich.) — expressed objections to CBP’s practices. They relayed accounts they had heard about individuals subject to humiliating searches, detained, and even chokeholds as CBP officials confiscated their devices. In addition, in light of complaints of individuals being forced to endure inappropriate questioning regarding their religion, political affiliations, and even charitable contributions, senators also raised concerns that individuals were being inappropriately targeted based on First Amendment-protected activities or other impermissible factors.

Congress can put an end to these types of incidents by passing legislation, including the Protecting Data at the Border Act. Congress should make clear that a warrant is required for all searches of the content of electronic devices; that travelers are not under an obligation to unlock or provide device passwords; and that individuals cannot be unreasonably detained for failing to consent to a search or to unlock a device.

Before such legislation passes, members of Congress should aggressively press the Department of Homeland Security to pass new rules to protect individual’s rights. CBP updated its guidance, which governs its searches of electronic devices, earlier this year, but the new rules still have glaring loopholes and deficiencies. As I explained in my testimony, DHS should be pressed to update this policy in four key ways:

Get a warrant

The policy should require a warrant in any case where the government seeks to search the contents of a device. Right now, the policy requires no suspicion of wrongdoing for basic searches, which includes a manual search of any of the documents, photos, or other information stored on a phone. This does nothing to prevent incidents, like this one, where officers reportedly looked through a traveler’s intimate photos with his wife without approval warrant.. Even for so-called “advanced searches,” which can involve the use of external equipment to copy or search information, the policy only requires reasonable suspicion or a national security concern, both of which provide a lower level of protection than a warrant.

Stop coercing travelers into handing over private information

The policy should clarify that travelers are not obligated to unlock a device or consent to a search. Currently, the guidance contains language stating that CBP believes individuals must present devices in a manner that allows inspection. This language is ambiguous and fails to make clear that travelers are not obligated to provide their passwords or help agents unlock their devices. In order to prevent individuals from being coerced into providing such information, the guidance should similarly prohibit unreasonably detaining individuals for failure to take such actions.

Prohibit border searches that are really for domestic investigations

The guidance should narrow the purposes of a search. CBP should be prohibited from conducting searches at the request of other agencies for law enforcement purposes — which allows the government to use warrantless border searches to circumvent Fourth Amendment restrictions that apply to domestic investigations. In addition, CBP should eliminate “national security concerns” as a ground to engage in suspicionless device searches. Such language is vague, could be interpreted as applying in cases where an individual poses no imminent threat, and increases the likelihood of discriminatory and arbitrary application of the policy.

Create consistency

Finally, DHS should adopt agency wide guidance. Currently, Immigration and Customs Enforcement — a DHS agency separate from CBP — maintains its policy dating from 2009. That allows border device searches without any suspicion of wrongdoing. Among other things, unlike in the CBP guidance, the ICE policy does not even clarify that device searches cannot reach information stored in the cloud. DHS should make sure the same policies apply to all agencies under its control.

Senator must press DHS to make these changes to end the invasive and humiliating warrantless searches that tens of thousands of travelers have been forced to endure.