That is exactly how it works actually. There are a series of ears around the door, and the pressurization of the cabin forces the door out and against the airplane frame mating ears.
The more it pressurizes, the greater the force jamming the door shut.
However, since it's a door, it has to be able to open. The door is constructed such that if you slide it upwards, the ears clear each other and the door can come out.
There are bolts to physically block the door plug from ever sliding upwards. If the bolts were correctly installed, or ever installed at all, the door would be perfectly safe.