{
  "id": 22488164,
  "title": "How we sandbox HTML5 game builds on a browser game platform with two CSP headers",
  "url": "https://urgent.news/2026/11/29/how-we-sandbox-html5-game-builds-on-a-browser-game-platform-with-two",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-29T01:29:39.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/webq3gaming/how-we-sandbox-html5-game-builds-on-a-browser-game-platform-with-two-csp-headers-4583"
  },
  "original_language": null,
  "account": "WEBQ3 Gaming offers free browser games, such as Power Surge: Planet Breakers and works by independent developers. The company faces a common challenge: how to run third-party game builds without granting them access to other parts of their site. The solution they found is two Content-Security-Policy (CSP) headers. One is placed on the game page, and the other on the separate origin that delivers the game build.\n\nThe game page, served from webq3.games, starts with the default-src policy set to 'self.' It then allows the game build to be embedded by framing it from the build host, webq3-games.netlify.app, using frame-src. The game page also prevents other sites from embedding its page through frame-ancestors 'none' and blocks any outside scripts from executing using script-src 'self' with a per-request nonce and 'strict-dynamic.'\n\nThe build host, webq3-games.netlify.app, sends a much stricter policy. It begins with the sandbox directive, which creates an opaque origin where the game can run JavaScript without navigation, popups, or form submissions. The build can only load assets from its host, and it can only be embedded by WEBQ3 Gaming's site thanks to the frame-ancestors 'none' setting on the build host.\n\nWhile this setup comes with trade-offs, it ensures the security of WEBQ3 Gaming's site. Many browser game platforms embed games in an iframe on their domain, but with the current restrictions, WEBQ3 Gaming can only be listed on directories that link to the game page. If they want to work with a specific portal, they can add that portal's exact origin to the frame-ancestors on the build host.\n\nTo serve untrusted or third-party game builds, WEBQ3 Gaming recommends using a separate origin, applying the sandbox directive to the build, and locking frame-ancestors on both the game page and build host. You can experience the results by playing Power Surge: Planet Breakers at https://webq3.games/games/power-surge-planet-breakers-e9db6900. For more information on publishing HTML5 games, visit the creator page at https://webq3.games/for-creators.",
  "summary": "WEBQ3 Gaming hosts free browser games, including our own arena fighter Power Surge: Planet Breakers and builds from independent creators. Every game runs in the page with no download and no account. That raises a practical question for any site that runs game code it didn't fully write: how do you let a build run at full speed without giving it access to the rest of the site? Our answer is two…",
  "summary_source": "publisher",
  "key_points": [
    "WEBQ3 Gaming uses two CSP headers to sandbox HTML5 game builds.",
    "First CSP header on game page allows embedding from build host.",
    "Second CSP header on build host restricts origin to WEBQ3 Gaming's site."
  ],
  "editors_take": "Using dual security headers allows WEBQ3 Gaming to run third-party builds safely while preventing untrusted code from accessing other sensitive parts of their website.",
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}