Undercover cops when drawing there weapon on someone are by law supposed to identify themselves as cops. Otherwise it is legal to act as though they are not cops because you really have no way of knowing. They also are supposed to produce a badge or ID if you challenge them.