What each of the research projects and horrors of the Holocaust that led to the drafting of the Nuremberg Code all have in common is the misuse of research subjects, specifically, the human beings victimized by ethically-challenged researchers. The concept of "informed consent" is a direct outgrowth of these projects, especially the Tuskegee Syphilis Study, during which medical researchers employed by the U.S. Government deceived African American men into allowing themselves to be human petri dishes for the development of a horrific disease. Basically, as a result of these projects, codes of conduct were put into place requiring that human research subjects must be fully informed of the nature of the research projects for which they have been recruited and the risks associated with their participation. Additionally, lest the researcher(s) consider exploiting individuals of limited intelligence who can be persuaded to sign consent forms, federal law requires that the intended research subjects be capable of fully understanding the risks involved in participating in the project in question. As the main federal regulation pertaining to this matter specifies:
"(N)o investigator may involve a human being as a subject in research covered by these regulations unless the investigator has obtained the legally effective informed consent of the subject or the subject's legally authorized representative. An investigator shall seek such consent only under circumstances that provide the prospective subject or the representative sufficient opportunity to consider whether or not to participate and that minimize the possibility of coercion or undue influence." [Title 21 U.S. Code of Federal Regulations, Part 50, https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfcfr/CFRSearch.cfm?fr=50.20]
The Stanford Prison Experiment that was conceptualized and overseen by Philip Zimbardo, an eminent psychologist associated with Stanford University, is a particularly interesting case in that no one apparently could foresee the consequences of the experiment. Unlike the German physicians behind some of history's most abhorrent practices, and unlike the American researchers who allowed African Americans to unnecessarily suffer from a painful debilitating disease, the Stanford Prison Experiment was simply characterized by a faculty member's willingness to use his human subjects in a questionable manner that resulted in permanent emotional problems for some of the participants. How much Zimbardo was able to predict regarding the eventual results of his experiment is uncertain, but he clearly hoped to document the possible deterioration of human conduct without adequately informing his human test subjects.
In conclusion, the series of studies and events specified in the question all involve the concept of informed consent, and current codes of ethics all reflect those lessons.