USSR and Japan were in an undeclared border war throughout much of 30s, notable escalation points are Battle of Lake Khasan (near North Korea/Manchuria/Russian border) and Battle of Khalkh River (around Mongolia/Manchuria border). This direction was advocated by factions within the Japanese military called Hokushin-ron (Northern Expansion Route), predictably, the navy wouldn't play much of a role in a war vs USSR, so the navy didn't like it (Japan had some serious interservice rivalry). The battle of Khalkh River was the final confrontation in which Japanese units (and the Hokushin-ron's prevalence) were crushed by Red Army units led by future Marshall Zhukov. After that, the conflict died down, the Japanese looked towards southern expansion (Nanshin-ron), the Soviets focused on Europe (Soviet invasion of Poland starting a day after Khalkh battle ended) and the two sides signed a non-aggression pact in 1941 (about 2 months before the German invasion).
There were some whispers in 41 and 42 within the Japanese military (especially the Kwantung Army) to attack the USSR when the Germans invaded, but nothing came of it (Battle of Moscow or Stalingrad may have been a trigger point). A few years passes, German-Soviet war is coming to a close and Stalin promises at Yalta Conference to join the war against Japan three months after German defeat in exchange for American acknowledgement for Soviet interests in East Asia.
Germany is defeated on May 8/9th and USSR invades Japanese holdings on 9th of August (btw first atomic bombing's on 6th of Aug). It is an absolute disaster for the Japanese, their Manchurian units have been continuously siphoned off to reinforce other units in more active fronts such as China or Pacific, caught in complete strategic surprise as they expected an invasion a lot further in the future. Red Army does struggle with some amphibious operations in Korea and Kurils, there are also reports of units running out of fuel and having to airlift supplies, but overall, it's a good result for the Soviets.
As for Allied attack from Soviet soil, there weren't attacks originating from Soviet soil. But Allied airmen did occasionally land on USSR after raids on Japan. Probably the most famous example is one of the Doolittle raid aircraft which landed in Russian Far East, the USSR staged an "escape" for them as they still wished to not cause an incident with Japan. This kind of thing happened a few more times, USSR decided to keep a B-29 frame for themselves which they reverse engineered into Tupolev Tu-4.
The Soviet Union declared war on Japan on August 8, 1945, shortly after the first atomic bomb was dropped on Hiroshima. Their alliances were on opposing sides of World War II, but Japan and the Soviet Union had signed a neutrality pact in April 1941. That prevented outright hostilities between the countries for most of the war.
The Soviet Union did launch a large offensive into Manchuria in August 1945, so there was fighting between the two countries. Prior to the 1941 neutrality pact, there was a series of battles between Japan and the Soviets along their border regions in Manchuria. The most significant was the Battle of Khalkin Gol in 1939. The battles were mostly inconclusive with little gained by either side but some, such as Khalkin Gol, did produce significant casualties. With hindsight you can certainly include these battles as part of World War II, but most of them occurred before Germany's invasion of Poland in 1939 and the signing of the Tripartite Pact in 1940. So they don't quite fit the framework of what you asked about, which seems to center on war between the Allies and the Axis.
Japan considered expanding its war in Manchuria into the Soviet Union in the late 1930s and early 1940s, but ultimately chose to push south into the Pacific instead. This decision was made for a number of internal and external reasons, but the Soviet defense encountered during the border clashes was one factor in that decision.
The neutrality pact prevented the Allies from using Soviet territory to launch attacks against Japan. The United States did briefly base some bombers in China to attack mainland Japan in 1944-45, but that effort was abandoned because of overwhelming logistical hurdles, as I answered here.
For its part, the Soviet Union had no interest in fighting a two-front war and launching hostilities against Japan. Soviet leadership during the war often felt (not without cause) that it was bearing a disproportionate brunt of the fighting against Germany while the western Allies bided their time. Joining in the war against Japan would have sapped Soviet strength from the war effort against the German Army, and that simply wasn't possible. Once Japan began its war against the United States in the Pacific, it was facing a similar situation. The Japanese army was bogged down in China and the navy (as well as parts of the army) were fighting against an opponent with much greater resources. Expanding the war effort to fight against the Soviet Union would have been foolish.
The neutrality pact held up remarkably well. In April 1945, with the war in Europe nearly over, the Soviet Union formally notified the Japanese government that the neutrality pact would not be renewed when it expired in April 1946. The original 1941 document required either party to give one year of notice if the pact was not going to be renewed, and the Soviets remained in compliance. But the Soviets had also made an agreement with the Allies to join the war against Japan three months after the war against Germany had ended.
By August 1945, Japan was seeking a negotiated end to the war. The Japanese government hoped that the Soviet Union would act as a mediator in peace talks with the other allies, believing that the neutrality pact would remain in effect until April 1946. The Soviets ultimately broke that agreement, keeping their agreement to the Allies instead. The Soviet declaration of war in August 1945 caught the Japanese by surprise and was a significant factor contributing to the end of the war. Japan agreed to unconditional surrender within a week.