A civil liberties group has published a new guide for people concerned about Canadian border agents searching their electronic devices like smartphones, laptops and tablets.

Although there are unsettled legal questions about how these searches should work, the B.C. Civil Liberties Association says “the bottom line is that the CBSA can and does search electronic devices at the border” without a warrant and sometimes randomly.

That means border agents could end up seeing private emails and text messages, photos, web browser histories and sensitive documents, even if you’ve done nothing wrong.

Here’s a look at what border agents can and can’t do, and ways to fight back if you feel your privacy is being breached.

Do border agents need to have a reason to search my device?

No, unlike police they don’t need to suspect anything.

However, CBSA policy is that officers ought to only “take a quick look” at each document before moving on to the next. For example, they should only look at documents or photos “for long enough to determine that they do not contain contraband such as child pornography or hate literature.”

If the CBSA officer sees something that raises their suspicions, a more thorough search may be conducted, according to the BCCLA guide.

Can border agents demand my password or that I use my finger to unlock a phone?

This may or may not be legal under the Customs Act, which states that people are required to “open or unpack any package or container that the officer wishes to examine.”

The question has not been settled in court, but the CBSA has admitted they do it on a “case-by-case basis.”

The BCCLA points out that not handing over a password could create a variety of problems, including increased suspicion, denial of entry into Canada, seizing of the device and even arrest.

The BCCLA says you may politely ask, “Do I have to do what you are asking me to, or am I allowed to refuse?” If the border agent insists, you might “communicate clearly that you do not consent to the search and that you are complying under protest.”

Can border agents download photos, text messages or emails to the device?

No. “If the CBSA wants to search information on the phone that is only accessible once it is connected to the cloud, they said, the agency must first obtain a warrant issued by a judge,” according to the BCCLA.

The CBSA’s policy is that officers should set the device to airplane mode before searching to “reduce the possibility of triggering remote wiping software, inadvertently accessing the Internet or other data stored externally or changing number versions or dates.”

Officers are supposed to only read emails that have been downloaded and opened, and they’re supposed to assess this “by seeing whether the emails have been marked as read.” The BCCLA assumes this also applies to text messages.

Can border agents copy the contents of my phone or keep the phone for further inspection?

Yes, in some situations. “The Customs Act gives the CBSA the power to detain goods if the officer is not satisfied that the goods have been properly screened for admission into Canada,” according to the guide. “This includes the contents of electronic devices.”

They may also make an exact copy.

They can also run “password-cracking software to try and access any data you did not provide a password to access,” according to the guide.

Is there anything I can do reduce the risk of border agents going through my device?

Yes. Meghan McDermott, counsel with the BCCLA, tells CTV News Channel that although “the best protection of your privacy is to not bring anything private with you,” not bringing a phone could raise the suspicion of border officials, leading to a time-consuming search.

Instead, she advises people to back up their devices on a hard drive at home or in the cloud, deleting anything sensitive from the device, and “then you arrive at the border with kind of a clean phone.”

It’s also a good idea to log out of programs and turn off the device so that agents will need to demand a password to get in. They may be too busy to bother waiting for you to turn on the device or enter passwords.

What can I do if there’s a problem?

The BCCLA recommends trying to record names and badge numbers of the officers involved, in case you want to file a complaint.

CBSA complaints can only be officially taken up with the CBSA itself, although their decisions can be appealed in federal court.

Other places to get help include human rights tribunals and civil liberties groups like the BCCLA.