A bill that would bar ambulance and first response service providers from disclosing or selling the information of patients to third parties was signed into law on Monday by Gov. Andrew Cuomo.

The bill is meant to close what amounts to a loophole in patient privacy laws that allowed service providers to sell information for marketing purposes, including addresses, phone numbers, prescriptions and medical history.

The new law prevents that disclosure save for health providers, a patient’s insurer and other parties with appropriate legal authority.

“Nothing is more personal than your health records, and New Yorkers have a right to privacy when it comes to this incredibly sensitive information,” Cuomo said. “This law sets clear guidelines so patient information isn’t sold or used for marketing purposes and most importantly doesn’t end up in the wrong hands.”

The bill was sponsored by Sen. John Liu and Assemblyman Edward Braunstein.