A fungal meningitis infection last year that spread in contaminated vials of medicine distributed by the New England Compounding Center in Framingham, Mass., led to 749 people becoming ill and 61 deaths in 20 states. Without doubt, this outbreak could and should have been prevented. Now, Congress is making headway toward writing laws that would prevent similar occurrences.

This is not the first time Congress has attempted to tackle the problems of so-called compounding pharmacies, lightly regulated firms that mix and ship medicines to hospitals and clinics, but previous efforts were frustrated by lawsuits and ultimately were ineffective. A legacy of the 2012 outbreak must be hard and fast rules that would prevent another disaster.

The Senate is poised to act soon — perhaps this week — on legislation already reported out of committee that would take a large step in the right direction. The Pharmaceutical Quality, Security and Accountability Act would put some of the firms in question clearly under the regulatory control of the Food and Drug Administration.

Because drafting legislation like this is difficult, the bill is not perfect. It contains some exemptions that cause us unease, including one for traditional compounders who mix drugs for health-care providers for use in their offices. This will continue to be beyond the FDA’s reach. Let us hope that will not become the next source of an outbreak.

We urge the Senate to vote expeditiously. It is not yet clear whether or how the House will act, but Senate passage of the legislation would provide an important signal that Congress is ready to make sure such a catastrophe is not repeated.