Space agencies across the world have long been aware of the risks of biological contamination, with planetary protection protocols already being established back in the 1960s. These rules have been updated and tweaked ever since, based on the new endeavors at hand. Some of the rules are: everything should be assembled in sterilized clean rooms; every spacecraft should include an inventory listing all organic matter making it on the trip; the total bioburden—the surface presence of microorganisms—should be below certain thresholds according to the category of the mission; and so forth.
Just in 2020, NASA updated its planetary protection policy for the Moon and Mars. This is a big step because, while exploring Mars was basically prohibited by the old contamination protocol, now the reform supports a human mission to Mars and gives guidelines on how to do so safely.