I feel this solves a very small part of the problem. This is only about the morality of the individual scientist, while the problem is at the level of the collective process of science. I mean, it is of course good if the individual scientist who discovers X way to kill off humanity keeps it secret, but eventually someone else will also discover X, and then someone else, and so on. Do we require of scientists that they all keep these things secret?
Of course, we may not want to have terrorists building atomic bombs, so some secrecy is prudent, but secrecy does not generally hinder: 1) Some bad people from accessing said information, now having monopoly, which may make matters even worse 2) Discovering the same thing independently - Yes, we may keep it secret, but that does not change the laws of physics, the exploitation potential is still there.
Of course, we may not want to have terrorists building atomic bombs, so some secrecy is prudent, but secrecy does not generally hinder: 1) Some bad people from accessing said information, now having monopoly, which may make matters even worse 2) Discovering the same thing independently - Yes, we may keep it secret, but that does not change the laws of physics, the exploitation potential is still there.