I think the Mastersword's moniker of "blade of evil's bane" is actually a huge misnomer. The sword doesn't care whether you're good or evil, as those terms are highly subjective anyway. The sword's actual primary purpose is to trump the Triforce, and nothing else. Basically it's the anti-triforce, created by Farore to give her protégé a tool to neutralize the other two Triforce parts in case they go rogue.
That's why the sword is only ever used when Ganon is involved somehow. It's effective against him because he has a Triforce himself, him being evil doesn't matter. If the sword was used against the likes of Vaati or Majora, despite them being evil, the sword would just act like a regular sword.
Curiously this also means the Mastersword would be super deadly if it's used against Zelda, but Link doesn't do that for obvious reasons.