There are many things which are illegal in Iran yet practiced widely, like consuming alcohol or being attracted to your own gender. I wouldn't use the Iranian book of laws as a moral compass myself, but to each their own.
Personally I think that it is not outside any moral boundaries to assassinate a scientist which is working on WMDs. In fact, I'll claim the opposite: if you are a leader of a country which you know is potentially targeted by WMDs and you have the strategic and tactical opportunity to assassinate the people working on that program, then you should.
Going back to laws, being a scientist doesn't give you any kind of immunity to any law. It shouldn’t grant you immunity here. Once you work on military programs, it's all fair game.
In both cases it's mostly posturing, but killing scientists and saying we had to, it's self defense is especially disgusting to me.