Basically, you should not be able to trace an alliance chain around to the point where it effectively makes you allied to the person you are at war with. (Alliances/Federations being considered the same thing here.)
A bit of speculation here, but if Corsanctum is allied to Morek, and Morek is allied to Swordfell, then neither Swordfell nor Corsanctum can declare war on the other. One of the two of them will have to drop the alliance with Morek, or convince Morek to drop the alliance to the other. This kind of diplomatic blocking is a popular tactic, especially for smaller realms seeking protection, or for big realms trying to protect smaller allies.
Note that this restriction applies to both declaring war and declaring alliances. You shouldn't be able to sign an alliance with your enemy's ally.