Let us assume our assassin is German, and ends up being accosted by German authorities after the shooting. What justification might they try?
There is a war going on.
While it is true that fighting in a war is not legally considered murder, for this argument to apply the act needs to happen as part of the war, and ideally take place between combattants. If our assassin had joined the Ukranian special forces, received orders to conduct the operation, and was wearing a uniform or similar while doing it, they'd be in the clear [as far as murder is concerned - there is still joining a foreign military]. But the assumption is that our assassin is not affiliated with Ukraine, and as such, they are clearly not a combattant. This argument doesn't work.
It was 'Notwehr'.
German law recognizes acting in defense of others as justification. If you come across a murder-in-progress, and killing the would-be murderer is the most viable way to stop it, you can kill the murderer. Our assassin could try to argue that Putin is engaged in the ongoing murder of Ukranian civilians, and that they killed him to stop that. The problem here is the unspecific casual connection between Putin's orders and people dying. For this defense to work, there should be a specific person who is still alive who would have been killed on Putin's orders if not for the assassination. This is unlikely.
It is none of your business.
Why would German authorities even care? Well, German law forbids Germans from murdering anyone anywhere (and likewise, it forbids anyone anywhere from murdering Germans).
It was necessary.
There is been extensive legal debate in Germany regarding the assination attempt on Hitler by Georg Elser in 1939. But no consensus has been reached as to how exactly the legal system should deal with 'Tyrannenmord', the act of killing an evil dictator. So even political considerations aside, the trial of our assassin would probably get very interesting - and I couldn't predict the outcome.