Unfortunately, advertisers are not always trusted, because of the resale of the ad space, you can show ads on ad networks that you donβt deal with directly and potentially run malware on your clients.
As for CSP: if you punch too many holes in the rules, it will become useless. There are a few things you can do, for example: an iframe sandbox
Alternatively, you can allow ads that use a secure subset of JavaScript (this check can be performed statically). "Safe" means that the document object will not be modified, etc. - The client should remain unaffected, even if the ad network is malicious.
An example is promiment ADsafe , but there are other options.
source share