Get the latest federal technology news delivered to your inbox.

The bill would require ads that run on Facebook, Twitter or other online platforms disclose who paid for them.

Sens. Amy Klobuchar, D-Minn., and Mark Warner, D-Va., introduced bipartisan legislation on Thursday that would force social media and other web platforms to disclose who paid for political ads posted on their sites.

The Honest Ads Act comes after a congressional investigation revealed that Russian groups purchased more than 3,000 political ads on Facebook, Google and Twitter in an effort to interfere with the 2016 presidential election. The legislation would expand the Federal Election Campaign Act’s definition of “electioneering communication” include paid political advertisements online. It also would require online platforms to keep a public registry of advertisers—in a machine-readable format—who have spent more than $500 cumulatively on online ads.

» Get the best federal technology news and ideas delivered right to your inbox. Sign up here.

“Laws have failed to keep up with evolving technology and the capabilities of our foreign adversaries,” said Klobuchar at a press conference. “Foreign agents are taking advantage of loopholes in our laws, which is why we’re introducing legislation to make online platforms disclose paid political ads just like broadcast, radio and print disclose information.”

With people increasingly getting their news online, it’s important they know who is sponsoring the content they see, Warner said.

“These companies in many ways rely on the trust of all of us who use the platforms” and should be held to the same standards of transparency as other traditional media outlets, he said.

Both senators said they hope to move the legislation along quickly so it will get passed ahead of the 2018 midterm elections and combat any future attempts at interference.

“This isn’t about one election or one party,” Klobuchar said. “It’s about our democracy.”

Sen. John McCain, R-Ariz., became the first Republican to sign onto the legislation after weeks of Democratic lawmakers seeking support from the other side of the aisle. As vice chair of the Senate Intelligence Committee leading the investigation into Russian meddling, Warner indicated that he expects a number of others to cosponsor the bill after hearing social media companies testify before the committee on Nov. 1.

Warner said he and other lawmakers plan to work with social media companies to ensure the bill maintains transparency without stifling innovation in the tech industry.