Does Islam allow punishment based on self confession ?

Jazzak Allah hul Khair.