People who promptly hand over illegally recorded conversations to police or corruption investigators will be protected under new legislation.