Eggs are very nutritious and versatile. But, they also bring a food safety risk due to Salmonella contamination. This risk can occur inside the egg and on the egg shell.
If a chicken is infected with Salmonella, it can contaminate the egg when it is formed inside the chicken. Farmers, big and small, must be vigilant to identify infected chickens and separate them from the rest of the flock. Chickens are messy, and they can pick up pathogens anywhere in their environment. Keeping coops clean is important.
Eggs are refrigerated for safety. If temperature abuse happens, that causes the egg to sweat and the porous shell will pull any contamination from outside the shell into the egg interior through osmosis.
In some locations, consumers are demanding cage-free egg production. This type of production only removes the cages. The chickens are still under one roof. The debate is ongoing whether this will be an advantage to make eggs safer.
Source: Food Safety Magazine, Dec. 2018/Jan. 2019, https://bit.ly/2CjvFqy
Egg Safety: What You Need to Know