IF IT WEREN'T for his excessive greed -- and an enterprising Copley News Service reporter named Marcus Stern, who first revealed his sleazy housing deal -- Randy "Duke" Cunningham might have been able to commit the perfect congressional crime.

The story of the San Diego Republican, who resigned from Congress last week after pleading guilty to taking $2.4 million in bribes from defense contractors, is in part the saga of a single, flawed individual who succumbed to temptation in the form of a yacht, a Rolls-Royce and a Louis Philippe commode. But it also exposes a pair of systemic fault lines -- the explosion in congressional "earmarking" and the growth in secret defense spending programs -- whose confluence enabled his criminal behavior.

Earmarks are provisions inserted by lawmakers to fund pet projects, and Mr. Cunningham used them to reward the contractors who were paying him off. They are the crab grass of appropriations -- a long-standing problem that has gotten out of control in recent years. A 2003 study by the Democratic staff of the House Appropriations Committee found that since the GOP takeover of the House in 1994, "earmarking in the Defense Appropriations bill has grown so rapidly that it now contains nearly as much in earmarked funds as the other twelve bills combined. While earmarks in the Transportation Bill have more than doubled, earmarks in the Defense bill have more than tripled."

Earmarks have evolved to be treated as a matter of entitlement on the part of individual members, who feel authorized to charge on the national credit card without having to do much to justify their purchases. Nor is there much incentive for the "cardinals" -- the subcommittee chairmen who are supposed to oversee individual spending bills -- to do their jobs; with term limits restricting their stints at the helm of a particular subcommittee, they have every interest in the continued happiness of the members with a say in their future chairmanships. In Mr. Cunningham's case, it's fair to ask: Where was the oversight from Appropriations Committee Chairman Jerry Lewis (R-Calif.), who headed the defense subcommittee until January?

The combination of money and politics can turn particularly combustible when mixed with the accelerant of secrecy. Add to the increasing practice of earmarking the growing amount of classified spending and you have a recipe for Cunningham-like chicanery. The level of secret spending on defense and intelligence is -- surprise! -- secret, but the best evidence is that it has grown even more rapidly than overall national security spending. When it comes to earmarking for classified programs, the primary check in the system is the integrity of the lawmaker pushing for the funding. As Mr. Cunningham's example shows, that's not enough.

Mr. Cunningham is, thankfully, gone from Congress, but the lapses he exploited remain. They must be fixed unless lawmakers want more Duke Cunninghams on their hands.