I know it's a possibility, so all I can do is mitigate the risk. I've intentionally focused on very small companies (<5 employees typically) where I almost always report to the top. I put myself in positions where I'm not just rank and file, but am essentially a hard dependency. Also in contracting roles you're usually not around that long. It's tedious finding work, but so is looking over your shoulder.