Skip to main content

Practical Implications

The Content Security Policy enforced on Greenhouse Games has direct implications for how you structure and develop your game. This page breaks down what’s allowed, what’s blocked, and how to work within the constraints.

All Assets Must Be Bundled Locally

The CSP restricts resource loading to 'self' (same-origin) for most directives. This means:
  • Scripts, stylesheets, fonts, and images must be included in your ZIP bundle — they cannot be loaded from external CDNs or third-party servers.
  • References to Google Fonts, Font Awesome CDN, Bootstrap CDN, or any external host will be blocked at runtime.
  • Include all dependencies directly in your bundle’s file structure.

Inline Scripts and Styles Are Permitted

The script-src directive includes 'unsafe-inline' and 'unsafe-eval', and style-src includes 'unsafe-inline'. This means:
  • Inline <script> tags work normally.
  • Inline <style> tags and style attributes work normally.
  • eval() and new Function() are permitted by CSP (though eval and Function constructor are flagged by the separate security scan — see Blocked APIs).
  • Dynamic style injection via JavaScript (e.g., element.style.color = 'red') works as expected.
Even though CSP permits eval(), the platform’s security scan still flags it as a blocked API. The CSP allows it to avoid breaking legitimate game engines that use code generation patterns, but direct use of eval will result in a security finding.

Blob URLs Are Permitted

The CSP allows blob: URLs in several directives (script-src, connect-src, img-src, frame-src, worker-src). This means:
  • You can dynamically create scripts, images, and workers from Blob objects.
  • URL.createObjectURL() works for generating runtime content.
  • This is useful for game engines that compile or generate code/assets at runtime.

Network Requests Are Restricted to Same-Origin

The connect-src 'self' blob: directive means:
  • fetch(), XMLHttpRequest, and WebSocket can only connect to same-origin endpoints.
  • Any request to an external domain will be blocked by the browser.
  • This includes analytics services, telemetry endpoints, multiplayer servers, and ad networks.
If your game makes external network requests, it will appear to work during local development without the CSP applied. Always test with the CSP locally before submitting.

Web Workers Must Be Same-Origin or Blob URLs

The worker-src 'self' blob: directive means:
  • Workers loaded from local files in your bundle work normally.
  • Workers created from blob URLs (dynamically generated) work normally.
  • Workers loaded from external URLs are blocked.

localStorage, sessionStorage, and Cookies Are Blocked

While not directly controlled by CSP, the platform’s JavaScript API restrictions block access to:
  • localStorage — blocked by security scan
  • sessionStorage — blocked by security scan
  • document.cookie — blocked by security scan
Games that use these APIs will receive a CRITICAL security finding and be automatically rejected. If your game needs to persist state, consider in-memory storage that resets between sessions. See Blocked APIs for the full list of restricted JavaScript APIs.

Summary Table