With major NSA surveillance authorities set to expire later this month, House Republicans are rushing to pass a bill that would not only reauthorize existing powers, but also codify into law some practices that critics have called unconstitutional.

The bill takes aim at reforming how federal law enforcement can use data collected by the National Security Agency, putting a modest constraint on when the FBI can conduct so-called backdoor searches of Americans’ communications. But because such searches make use of a legal loophole, critics say the current bill may do more harm than good by explicitly writing the practice into law.

The bill would reauthorize Section 702 of the Foreign Intelligence Surveillance Act, which serves as the basis for some of the NSA’s largest surveillance programs, and keep it on the books through 2023. The law was first passed in 2008 after the George W. Bush administration’s secret warrantless wiretapping was made public, effectively to legalize what the administration was doing.

The law allows the intelligence community to spy on Americans’ transnational communications without a warrant so long as the “targets” are not Americans. In 2013, documents leaked by whistleblower Edward Snowden revealed that the NSA vacuums up a tremendous amount of wholly domestic communications through the program as well.

Republicans tried to ram through a different incarnation of the bill last month, based on a more draconian version passed by the House Intelligence Committee. During a daylong push to drum up support, Republicans on the committee circulated fliers depicting enlarged photos of Islamic State fighters, trying to give the impression that failing to pass that bill would be a gift to foreign terrorists. But leadership backed off after determining they didn’t have enough votes to pass it, according to multiple congressional sources. Domestic surveillance is the rare issue on which hard-right Republicans and left-leaning privacy advocates often find common ground.

The new version of the bill, posted on the Rules Committee website late Friday, is designed to get the buy-in of Republicans on the Judiciary Committee. It includes compromise language taken from a separate bill passed out of that committee in November, which included some modest limitations on existing authorities, including the reform to backdoor searches.

The bill takes aim at one of the key problems with the original law: that Section 702 doesn’t limit how data can be used by federal law enforcement. That has given rise to the backdoor search loophole, in which the NSA shares certain kinds of information with the FBI, which the FBI then uses to search for Americans’ communications without a warrant.

Privacy advocates have called backdoor searches unconstitutional and urged Congress to close the loophole by requiring the FBI to get a court order to query Americans’ communications. The current bill takes a crack at doing so, requiring the FBI to get a warrant before searching the data in relation to an open criminal investigation.

But the bill carves out large exceptions. The FBI doesn’t have to apply for a warrant when national security is involved, or when it determines that there is a “threat to life or serious bodily harm.” And the bill would continue to allow the FBI to sift through the data even when those searches don’t involve a specific criminal investigation, which the FBI already does so often that they have compared it to searching Google.