Update: as of March 2022, travel to Russia is unsafe for anyone.
The country is not even safe for its own citizens.
Anyone — regardless of whether you're a Russian national or not, no matter what ethnicity you are — may face harassment, death threats and legal action (up to 15 years in jail) for opposing the Russian invasion of Ukraine, or expressing any anti-war sentiment. These are very tangible threats which I have witnessed first hand.
Additionally, various payment services, flights and apps are getting blocked or canceled, some by the Russian government, some by the foreign businesses themselves. That may leave you stranded, without money and reliable means of communication or even access to independent news sources.
If you are in Russia:
- Exercise continuous caution.
- Always maintain your integrity and speak up against the war whenever possible, if possible.
- Use VPN services to access independent media.
- When participating in anti-war protests, research the nonprofit organizations and volunteers that help people who were detained, such as OVD Info. Know the risks and ways to mitigate or avoid them before protesting. Know the extra risks of being a foreign citizen at a protest. There are good materials on the web that cover these topics.
- Allow yourself some healing time. Take breaks from the continuous stream of negativity, and focus on something pleasant every now and then, whether it be a stroll at a local park, some exercise, or just having a cup of tea. Practicing mindfulness might be a good option if you can convince yourself to do it. A lot of people in Russia are experiencing feelings of hopeless and depression. But those are health risks on their own, and will not solve anything.
That all said, I will maintain that I don't think that being a foreign citizen would put you in a much greater risk category. I still think most people don't care about that stuff or may even express some interest and a degree of respect. But you must understand that right now it is dangerous for anyone who is not a Putin supporter.
As long as Putin's presidency subsists, the safety risks will most likely continue increasing. The answer will need to be revised once more when the presidency changes.
For the historical purposes, I'll leave the original answer below.
I'm a Moscovite, so this answer is bound to be biased.