Why it matters: As the number of travelers who are denied entry in the US by Border Patrol gets higher, it's important to take a look at the reasons why that can happen for you, even if you're a US citizen. It turns out you can be questioned about your friends' social media activity, especially if they may hold views that oppose the interests of the US, or anything that can be deemed as anti-American.

When news broke in July that China's border police were installing surveillance software on tourists' smartphones, that likely didn't surprise anyone. By now, everyone is familiar with China's penchant for surveillance and monitoring, which applies not only to foreigners but also its own people.

Every time you're entering the US, federal agents are allowed to search you and your belongings regardless of whether you are a citizen or a visitor and without a warrant. Their broad authority extends to your personal electronics, and US Customs explained in 2017 that cloud data is off limits, including social media accounts. That wasn't the case for Ismail Ajjawi, a Harvard student from Lebanon who was denied entry in the US after immigration agents sifted through his friends' social media posts and found they held strong anti-American views.

The seventeen-year-old student told The Harvard Crimson that officials at Boston Logan International Airport ordered him to unlock his laptop and phone and spent five hours looking for objectionable information. The officers also questioned him about his political and religious views, and were particularly upset about the ones shared by his friends on social media.

Ajjawi said "I have no single post on my timeline discussing politics," but his visa was nevertheless canceled and he was deported as a result. The good news is that he can reapply for a visa, and Harvard is working with authorities to expedite the process so that he can join his classmates before the classes start on September 3.

Customs & Border Protection searched 33,000 people without a warrant in 2018, which is a significant increase from the 4,500 searches registered in 2015. Starting in June this year, the Trump administration demands foreigners who apply for US visas to give their social media handles to authorities. The FBI also wants to start monitoring popular social platforms like Facebook and Twitter for "potential threats to the US." All of this has invited criticism from privacy advocates like Summer Lopez, senior director of Free Expression Programs at PEN America.

In a press release, Lopez says "this is a move so perverse, so grotesque as to defy explanation. Preventing people from entering the country because their friends critiqued the U.S. on social media shows an astounding disregard for the principle of free speech. The idea that Ajjawi should be prevented from taking his place at Harvard because of his own political speech would be alarming; that he should be denied this opportunity based on the speech of others is downright lawless."

It's worth noting that while you theoretically can refuse to give customs officers access to your devices, that isn't going to make your life easier even if you're a returning US citizen. Experts say the agents have no obligation to allow someone into the country and recommend either carrying burner phones or not bringing any electronics with you at all.

When US border officials testified under oath, the ACLU found that ICE and CBP "are asserting near-unfettered authority to search and seize travelers' devices at the border, for purposes far afield from the enforcement of immigration and customs laws." Officials can then use the data from searches and share it with law enforcement in the US and around the world, but the ACLU argues "the government cannot use the pretext of the "border" to make an end run around the Constitution."

The problems don't end here, with the US customs scrambling to implement face recognition systems at airports by 2021 despite the obvious privacy and security implications of rushing through this process. The US government is using the pretext of national security to justify these efforts, but according to the Office of the Inspector General, CBP agents are failing to delete traveler data and also admitted that some of it ended up in the hands of hackers last year.