Gas spring with safety protector and lock for machinery