How to validate an issue link with a specific issue type?

I create new link type is Tracks

  • Outward Link is “tracks”
  • Inward Link is “contributes to”

What I want is a Story can “tracks” a Task but cannot “contributes to” a Task. And a Task can “contributes to” a Story but cannot “tracks” a Story
How can I prevent or validate that?
Please advice! Thanks!