The Daniel Anderl Judicial Security and Privacy Act, named for the son of a federal judge who was fatally shot in 2020, was attached to the annual must-pass defense policy bill that the Senate endorsed 83-11.
The defense bill passed the U.S. House of Representatives last week and now heads to President Joe Biden for his signature.
The judicial security measure, which the federal judiciary backed, had long languished in Congress before its supporters were able to tack it on to the National Defense Authorization Act.
The measure remained in the 4,000-plus page defense bill despite criticism from public interest groups who say it could chill free speech and undermine efforts to scrutinize judges' conflicts of interest.
Sponsors of the bill, including Senator Bob Menendez, a New Jersey Democrat, say it is narrowly tailored to protect judges.