dig your own grave

中高级 (B2)informal

To create your own downfall.

"By leaking the information, he was essentially digging his own grave."