I'm seeing a lot of duplicate advice and questionable advice from several answers here. If you are told to do something and you don't want to then don't. There are consequences to the choices you make, of course. Could you be terminated if you don't do what the boss wants you to do? Of course. But you could also be terminated if you do do what the boss wants you to do. (I'm assuming you're hired at-will.)
I do find myself in a position at times against what my boss wants me to do. I do get things done in the way he wishes sometimes, but other times I do find ways to do it my way. You have to balance it. Give 'im just enough of what he wants; you do the rest.
Please note that if you do something illegal, it doesn't matter if someone else told you to do it. You are still breaking the law. And, yes, you, and you alone, can be held accountable for that.
Take this story I heard recently:
At an airplane manufacturing plant, certain components need to be X-rayed to verify their quality. The components are sent on a conveyor belt, and the technician checks the X-ray at his workstation and clicks the button that says Accept or Reject. One particular incident resulted in airplane crashes. After several months of investigation, they discovered the culprit, and they had recorded video. This technician was eating his snacks at the X-ray terminal and watching his phone. While distracted, he was simply pressing the Accept button for every single one of the components. He was legally held accountable (i.e. arrested).
At the same time, it is important not to get your feelings mixed up in legalities. You may feel that exposing your customer's data to the public is illegal, but I'm not aware of any US law that states that. There may be something in Europe. In the US, like it or not, it's the company's data, not the customer's. Now, if that data included credit card information, then that might be an issue with PCC compliance, but I'm not sure how law enforcement can get involved in that. You'd have to look into that. As others stated, go seek advice from a lawyer if you're worried.