You can make cookie dough that's safe to eat by heat-treating your flour and using pasteurized eggs — or use no eggs at all.
When I first tried to make my own edibles a few years ago, I went through the trouble of decarbing flower (the process that activates THC) and then infusing it into butter using an expensive machine ...