[ARCHIVE ANSWER]
The best way to spot an undercover is to insist they take a bong rip. Undercover kops can fake hit a joint but not a bong. Undercover kops are forbidden to use drugs. Beware, though, that informants will rip a bong and then bust you. Rig a cheap camera to catch the area where the suspected person will take the bong rip. Hide this tape off your property somewhere safe. If you are raided because the kop was crooked, your video evidence of him smoking pot will
trigger a drug test on the kop, and you will go free.