dig your own grave

中上級 (B2)informal

To create your own downfall.

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