dig your own grave

Intermédiaire supérieur (B2)informal

To create your own downfall.

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