Like everyone else already said, yes they can open everything entering the country. The only reason you are present at the airport when they open and search your suitcases is because they want to have a look at you while they do it and ask you question (so that you ideally confess to everything etc). It wouldn't be legally nessecary for you to be present. That's just a law enforcement trick to get you sweating and talking (if you'd done something wrong).
My fear is just that they can steal stuff from my package or plant drugs or something and I'd have no way of defending myself.
Concerning the Drugs: You send the packages to yourself? You are recipient
and sender at the same time? Only in that case would that be a real risk to you. Having not send the packages, they'd be able to charge you - but would have to prove that you orderd this. Which would be hard - if you really hadn't ordered drugs somewhere.
But yeah, if law-enforcement is crooked and wants to plant something on you - you'll always be in trouble, everywhere. Horror Stories like that are readable everywhere.
Stealing - that's more likley with baggage handlers or postal-service employees than custom agents. But of course possible. And the officers of course risk you filing charges against them if they steal from you ...
Another thing is, Portugal has one of the most liberal Laws towards the posession of illegal drugs in Europe. As long as you're not Walter White, you'll be fine