Iran and Syria have an official defence pact. Iranian forces are embedded in Syria and likely be directly engaging Israeli forces if the big one broke out. If Israel attacks Syria then Iran can claim casualties on its troops as justification for retaliation for Israel.
While I agree the technical legal ground may be shaky if Israel openly declares neutrality in case of a war and proclaims it will not attack Iran.
in such scenario the legal grounds would be a little murky. but it would be for lawyers to deal with....
saddam randomly starting attacking Israel unprovoked in 91. you really think Iran is going to refrain when it has invested so much in it?
I cannot see how Israel would stay out of such a regional conflict. the only question would be to what extent would Iraq, and Afghanistan get involved?
and if Iran will take out Persian gulf arab expensive petroleum infastracture to really bring the world economy to its knees?
you can begin to sense how messy and suicidal any war with Iran is going to be...