Disclaimer: The following post includes unfunny jokes about the Coronavirus (COVID-19) and the Corona crisis. Some people may find this content offensive, so continue reading at your own risk. This blog should not be taken seriously under any circumstances.
The Coronavirus is creating shock waves around the world, forcing more developers to work from home. While the practices to avoid the Coronavirus spread among humans is pretty clear for most of us, this blog will cover the best practices to avoid your code from being infected (prevention), checking to see if your code is infected (detection) and what to do in the case of contamination (post-infection). It is also important to remember that the statistics show us that new (freshly developed) code has a higher chance of recovery after infection. Legacy code (any code that was created before the year 2010) is at the high-risk group.
Due to the high infection rate and the fact that Alibaba AI didn’t create the anti-coronavirus, all experts agree that the best cure, for now, is prevention.
Handshaking is the most common way to establish an exchange of information between two machines. Unfortunately, this is also the most common way to get infected and to spread the Coronavirus. Therefore, try to avoid using protocols that require handshaking to start communication (e.g. TCP, TLC, etc.)
Crowded places like stack overflow and open source projects, especially the ones with plenty of contributors, have more chances to contain code that is infected by the Coronavirus. Instead, try to copy code from your teammates, unpopular open-source projects, and bad stack overflow answers.
Now it is the best time to stop writing “quick-and-dirty” and to start refactoring, so you will have clean code because keeping high code hygiene standards will help to avoid infection. Also, be sure to verify you’re sanitizing (any) input data received, especially if it received from external services.
If your code is acting funky, maybe it is not because you’re a sh*ty developer, but because you got infected. It is crucial to constantly debug, monitor and scan your code with different anti-viruses solutions (like VirusTotal) to check your code health.
If you find that your code got contaminated, you should follow the guides under this section ASAP!
Thanks to the ability to use
git blame it is possible to detect how your code got infected so the relevant safety measurements can be taken to prevent the spread of the Coronavirus.
Infected code should stay in quarantine until fully recovered. Therefore, if your app contains code with Coronavirus, for public safety, it should be accessible only on the localhost and not exposed to the world.
Contrary to the myth that masks should protect you from getting infected, they are actually supposed to help infected code not to infect other code snippets out there. So if you MUST deploy your code on the WWW, at least mask your server IP to minimize the exposure to others.