Wrong on both counts. They do not have to id themselves as cops when undercover as it could cost them their lives, depending on who they are talking to and they are allowed to partake as part of their undercover work, again because if they do not, they could die depending on who they are dealing with.
I believe (but could be mistaken) that this was ruled on by the supreme court a few years back.