Tech giants such as Google, Facebook, and Twitter have joined more than two dozen rights groups in slamming the US Department of Homeland Security (DHS) over plans to inspect foreign visitors' social media accounts as a way of determining if they pose a security threat.

Back in December, the DHS confirmed it would be reviewing its policies on when officials can examine would-be immigrants' social media posts as part of the vetting process when applying for certain visas. The plan arrived just weeks after the San Bernardino Inland Revenue shooting.

One of the shooters, Tashfeen Malik, had allegedly "pledged allegiance" to ISIS on several social media sites, including Facebook, though this was later denied by FBI boss James Comey, who said support was expressed through "private direct messages."

In June, the DHS proposed extending the plan to cover all non-US citizens coming into the country who don't have a visa. Visitors will be asked: "Please enter information associated with your online presence---Provider/Platform---Social media identifier," on the travel forms they must fill out to enter the US. While filling in the section isn't mandatory, leaving it blank will doubtlessly raise suspicions.

Politico reports that leading tech firms have said the proposals could "have a chilling effect on use of social media networks, online sharing and, ultimately, free speech online."

In an open letter signed by 28 rights groups, including the Electronic Frontier Foundation and the American Civil Liberties Union, the organizations wrote: "This program would invade individual privacy and imperil freedom of expression while being ineffective and prohibitively expensive to implement and maintain."

Access Now, a public interest group that also signed the letter, has submitted more than 2300 comments to the Customs and Border Protection's regulatory docket, the overwhelming majority of which oppose the plans. The government is taking comments on the proposal until August 22.