You might want to go naked on your next vacation — digitally speaking, anyway.

Wall Street Journal Mideast reporter Maria Abi-Habib wrote on Facebook Thursday that Department of Homeland Security agents stopped her at Los Angeles International airport, demanded to see her phones, and only let her leave because she told them they’d have to speak with the newspaper’s lawyers.

The DHS agents were operating within the law, which says that anyone traveling through official entry points to the United States can have their devices taken from them. The idea is to give DHS powers it needs to protect national security, but in Abi-Habib’s case, the agents might have been more worried about finding out who her sources are based on any of the data stored on her phones. They didn’t get the chance (this time) but Abi-Habib advises caution on the border.

“This law applies at any point of entry into the U.S., whether naval, air, or land and extends for 100 miles into the U.S. from the border or formal points of entry,” she said. “So, all of [New York City] for instance. If they forgot to ask you at JFK airport for your phones, but you’re having a drink in Manhattan the next day, you technically fall under this authority. And because they are acting under the pretense to protect the U.S. from terrorism, you have to give it up.”

Here are the tips Abi-Habib gave for protecting your privacy while you travel:

Always use encryption

“If you are contacting someone about a sensitive matter, use an application like Signal,” Abi-Habib said. But be warned that encrypted communications tools don’t automatically erase message logs, so you’ll have to do that manually, at least until Facebook’s “secret conversations” come to Messenger and people are able to set those messages to self-destruct.

Never download anything suspicious

“Never download anything or even open a link from a friend or source that looks suspicious,” Abi-Habib said. “This may be malware, meaning that they have downloaded software on your phone that will be able to circumvent the powers of encryption. Don’t leave your phone unattended for the same reasons — they can just open it up and download malware.” (Or they could use hidden voice messages to trick voice-activated assistants like Siri or Google Now into adding it for them.)

Travel naked

Not literally.

“[I]f you have something extra sensitive on your device — phone or laptop — do not travel with it and instead use your sim card in a clean phone,” Abi-Habib said. “And for sensitive numbers, write them on a piece of paper you can somehow secure and then restore the factory settings on your phone — which seems to be the only way of wiping it clean 100%.” Much like never carrying cash so you don’t have to worry about pickpockets, always using a clean device means you don’t have any sensitive information for the government to access in the first place.

Read her full post here.

A document DHS agents provided to Abi-Habib.