The part that's clearly wrong is stopping innocent people from engaging in harmless trade. If it weren't for the sanction, it would probably be illegal for slack to deliberately block Iranians just because of the country they're from.
And something doesn't have to be morally good for stopping it to be morally bad. For example, playing chess is morally completely neutral, but it would be morally bad to attempt to ban chess.
Likewise, Iranians using slack isn't obviously morally good, it seems morally neutral, but enforcing a slack ban against Iranians is obviously morally bad.
Are you being deliberately obtuse? Canada doesn't have anything to do with this. Amir's account was closed because of his Iranian ties, not his Canadian ones.
And something doesn't have to be morally good for stopping it to be morally bad. For example, playing chess is morally completely neutral, but it would be morally bad to attempt to ban chess.
Likewise, Iranians using slack isn't obviously morally good, it seems morally neutral, but enforcing a slack ban against Iranians is obviously morally bad.