Social media surveillance doesn’t always stop when travelers reach American shores, where their web of local contacts are likely to expand. Last year, Immigration and Customs Enforcement awarded a $100 million contract for continuous monitoring of 10,000 people annually that it calls high risk, and D.H.S. leadership has made it plain that it is looking for ways to monitor visitors and immigrants inside the United States.

[If you use technology, someone is using your information. We’ll tell you how — and what you can do about it. Sign up for our limited-run newsletter.]

Social media can reveal the most intimate aspects of our lives: whether a person is gay or straight, whether she is a gun owner or a supporter of Planned Parenthood, whether she goes to the mosque on Fridays or to church on Sundays.

While this type of information is not relevant to security, it can be used to go after people the authorities disfavor by refusing them entry to the country, deporting them, targeting them for investigation, sharing their information with a repressive foreign government or just hassling them at the airport.

One of President Trump’s first acts in office was to bar travelers from several Muslim countries. When the ban was struck down by federal courts, the State Department imposed additional vetting measures that just happened to cover about the same number of people as the ban. The following year, a draft D.H.S. report proposed tagging young Muslim men as “at-risk persons” for intensive screening and continuous monitoring. The administration has gone after those opposing its draconian immigration policies too, using social media to track activists from the southern border to New York City.

The D.H.S.’s own tests show that social media content is an unreliable basis for making judgments about national security risk. A brief prepared for the incoming Trump administration explicitly questioned its utility: In pilot programs it was difficult to match individuals to their social media accounts, and even where a match was found, it was hard to judge whether there were “indicators of fraud, public safety, or national security concern.”

False negatives were a problem too. One program for vetting refugees found that social media did not “yield clear, articulable links to national security concerns,” even for applicants who were identified as potential threats based on other types of screening.