This is bullshit…. Cop pulled me for a taillight and demanded to search the car. I told him no but he did it anyway. Then he found an old box cutter that had fallen under the seat. I tried to tell him that it was for a sheet rock job I had a long time ago but he took it away and charged me with a CCW. I think that it was because he searched my record from his police car and found that I'd had some problems a long time ago and just ASSUMED. WTF? I don't need this shit.
Generally speaking, a police officer can search your vehicle without your consent or a warrant if they have probable cause for an arrest, for officer safety, or reasonable suspicion of criminal activity. They can also search an impounded vehicle to inventory its contents.
In your case, the broken light is sufficient for the stop. As for the search, if challenged, the police officer would have to articulate the facts giving rise to his reasonable suspicion of criminal activity. With regards to the box cutter, it is not unlawful to possess unless you have the intent to use it unlawfully against another.
I know you don't need this, but now you've got it. Your next step is to hire a lawyer to represent you in court and commence a suppression hearing to preclude the weapon from evidence, as the search was illegal. You can expect to spend at least $5,000.00 for a lawyer that has the skill set you need. Best of luck!