Adding local task tabs to node display for specific content type
Solution from Matt B only hides the tab on the node view page, but not on the node edit etc. The direct url will also be accessible in that case.

A better solution is to write a custom access handler

See Custom validation of route parameters