Self-ruin. A sarcastic remark about someone’s deceits which will eventually get them in trouble. A rope is used for hanging, of course, so give them enough rope is to allow someone to continue their ignorant or devious ways until they fail or are caught, thusly get hanged. (Compare to Flirting with disaster, Lay an egg or Fly too close to the sun.)
“The judge just let the guy keep talking and talking until the guy he confessed. It proves that if you give someone enough rope, they’ll hang themselves.”