Blocking WebRTC DataChannel & STUN Exfiltration in AI Webviews and Checkout Frontends: CSP Directives vs Browser-Level Controls
With WebRTC-based client-side skimming making headlines, our security team audited both our React checkout pages and the sandboxed Playwright/webview browser our AI agents use to interact with third-party SaaS apps.
Here is the surprise we hit:
Most teams assume setting Content-Security-Policy: connect-src 'self' https://api.ourdomain.com stops unauthorized data exfiltration.
However:
- WebRTC
RTCPeerConnectionICE/STUN/TURN traffic operates over UDP/TCP outside standardfetch/XHRinterception hooks. - Even if DataChannels are blocked at a firewall, encoding short secrets into STUN/ICE subdomain lookups can still leak data if DNS isn't locked down.
What is the cleanest combination of CSP, Permissions-Policy, and Chromium/Playwright flags to kill unauthorized WebRTC egress without breaking legitimate app features?