Cannabis is a bioremediator and absorbs basically every environmental toxin from the ground (pesticides, heavy metals, etc.). Extraction (for CBD and THC oil) increases the concentration of any present toxins.
The only way you know of the problem is by thoroughly testing every batch. Pesticides that are safe at low levels can get concentrated and become really problematic at high levels.
States where marijuana is legal require all of this testing, so the products are much safer. Hemp-derived THC does not require these tests. (Same is true for CBD, but that's a while other conversation...)