Gazeta.ru reports (translated by the Interpreter blog,) that Russian Ambassador to the United Nations Vitaly Churkin is already prepared with a legal justification if Russia decides to send troops into Ukraine:
'There are relevant norms in the UN Charter, Art. 51 of the Charter, which speaks of self-defense, and which we, by the way, activated during the conflict in the Caucasus in 2008," he said on the air in the program 'Sunday Evening with Vladimir Solovyev.'
'So we have international legal grounds. There is the relevant decision of the Federation Council,' noted Churkin.
Article 51 states that “Nothing in the present Charter shall impair the inherent right of individual or collective self-defense if an armed attack occurs against a Member of the United Nations, until the Security Council has taken measures necessary to maintain international peace and security.”
As written, the article was likely originally meant to refer to nations under direct attack from other nations—if a country’s capital is being bombed, it doesn’t need to wait for a Security Council resolution to fight back.
It would be hard to argue that any Ukrainian military operation on its own territory constitutes an “armed attack” on Russia, but throughout the conflict Russian leaders have referred to their obligation to protect their citizens and interests in eastern Ukraine, as well as the more radical argument that they are responsible for the protection of the people of “new Russia,” who unjustly found themselves on the wrong side of the border after the breakup of the Soviet Union.
In the Calvinball world of international law, Article 51 has been invoked over the years for a number of operations, from Britain’s intervention in Suez to the U.S. invasion of Panama to Israel’s Operation Cast Lead in Gaza to Kenya’s pursuit of al-Shabab in Somali territory, that don’t involve a previous direct attack.
So yes, self-defense is a pretty frequently abused concept when it comes to war. But all the same, given the fairly abundant evidence that Russian forces are supporting if not entirely coordinating the separatists in eastern Ukraine, it would be pretty rich for Russia to make the case that it's the one under attack.