Describe the bug
The three.js app uses this code:
| asyncfunctionexecuteThreeCode( |
| code: string, |
| canvas: HTMLCanvasElement, |
| width: number, |
| height: number, |
| ): Promise<void>{ |
| constfn=newFunction( |
| "ctx", |
| "canvas", |
| "width", |
| "height", |
| `const { THREE, OrbitControls, EffectComposer, RenderPass, UnrealBloomPass } = ctx; |
| return (async () => { ${code} })();`, |
| ); |
| awaitfn(threeContext,canvas,width,height); |
| } |
This requires the unsafe-eval CSP policy. However, the server does not define a CSP policy and from my understanding of the spec it should not be provided by default
| -**Restrictive Default:** If `ui.csp` is omitted, Host MUST use: |
| |
| ``` |
| default-src 'none'; |
| script-src 'self' 'unsafe-inline'; |
| style-src 'self' 'unsafe-inline'; |
| img-src 'self' data:; |
| media-src 'self' data:; |
| connect-src 'none'; |
| ``` |
Additionally, there is no way to make it work as the spec currently does not provide servers a way to request unsafe-eval:
| ```typescript |
| const csp =resource._meta?.ui?.csp; |
| |
| const cspValue =` |
| default-src 'none'; |
| script-src 'self' 'unsafe-inline'; |
| style-src 'self' 'unsafe-inline'; |
| connect-src 'self' ${csp?.connectDomains?.join('') ||''}; |
| img-src 'self' data: ${csp?.resourceDomains?.join('') ||''}; |
| font-src 'self' ${csp?.resourceDomains?.join('') ||''}; |
| media-src 'self' data: ${csp?.resourceDomains?.join('') ||''}; |
| frame-src 'none'; |
| object-src 'none'; |
| base-uri 'self'; |
| `; |
| ``` |
To Reproduce
Steps to reproduce the behavior:
- Build a complient client with CSP policies
- Try to run the threejs example
You get an error:

Expected behavior
I think the spec should be revised to support trusted types or let the UI request unsafe-eval
Logs
N/A
Additional context
N/A
Describe the bug
The three.js app uses this code:
ext-apps/examples/threejs-server/src/threejs-app.tsx
Lines 122 to 137 in e514e6c
This requires the
unsafe-evalCSP policy. However, the server does not define a CSP policy and from my understanding of the spec it should not be provided by defaultext-apps/specification/draft/apps.mdx
Lines 202 to 211 in e514e6c
Additionally, there is no way to make it work as the spec currently does not provide servers a way to request unsafe-eval:
ext-apps/specification/draft/apps.mdx
Lines 1411 to 1426 in e514e6c
To Reproduce
Steps to reproduce the behavior:
You get an error:
Expected behavior
I think the spec should be revised to support trusted types or let the UI request unsafe-eval
Logs
N/A
Additional context
N/A