More than a year after Edward Snowden fled the country to expose National Security Agency programs, Congress has taken its first significant steps to reign in the spy agency.

The so-called Massie-Lofgren amendment, a joint amendment by Reps. Thomas Massie (R-Ky.) and Zoe Lofgren (D-Calif.), passed late Thursday night. It seeks to close several perceived loopholes practiced by the NSA by preventing the agency from using any of its annual budget, renewed each year as part of the massive annual Defense Appropriations Act, for certain programs.

Referred to by privacy advocates as a means to “shut the back door,” the amendment keeps the NSA from using Section 702 of the FISA Amendments Act, originally intended to help American intelligence agencies track foreign intelligence targets without having to get a warrant, from being used to spy on Americans. It’s Section 702 that gives the NSA the legal authority to use its PRISM search program, which allows it to quickly gain access to users’ stored information—including emails, chats and Web histories—from Facebook, Google, and several other major American tech companies.

The amendment closes a second kind of “back door,” too, in that it prevents the NSA from using funds to encourage private companies from building vulnerabilities into their products for the agency to exploit, another practice revealed by Snowden’s documents.

Unlike the first congressional effort to try to temper the NSA, a failed 2013 amendment from Rep. Justin Amash (R-Mich.) to that year’s Defense Appropriations Act renewal that aimed to keep the agency from tracking American phone records in bulk, this vote wasn’t even close. It’s not immediately clear if the vote outcome was due to the late hour (it came after 9pm EST Thursday), activist effort, or simply a sea change in attitudes towards the NSA, but the Massie-Lofgren amendment passed with an overwhelming majority, 293-123.

In May, the House passed the once-vaunted USA Freedom Act, originally written as a major NSA overhaul, but which had become so bogged down with amendments that practically all privacy groups and tech companies that had enthused about it withdrew their support.

“We took a big step tonight to ?#?ShutTheBackDoor? on unwarranted government surveillance,” Lofgren announced on her Facebook page. “The House stood up for the American people and the Constitution, and that is something we can all celebrate.”

Photo via Serge Melki (CC BY 2.0)