Hi,
I’m working on a classic GWT application and trying to apply a strict Content Security Policy (CSP) using a nonce generated per request.
CSP Using:
What’s working:
The app loads and runs correctly.
GWT is able to load its scripts dynamically.
The iframe now uses a safe URL (about:blank) instead of a javascript: URL and works with the current CSP.
No functional issues in the app.
What’s the problem:
Even though everything works, the browser console shows this error:
The stack trace originates from GWT code-splitting (runAsync), specifically during execution of split fragments (e.g., application-0.js).
This appears to involve runtime JavaScript execution via javascript: URLs, which is blocked under strict CSP.
My questions:
Is there a supported way in GWT to avoid this javascript: execution when using code splitting?
Is this console error considered a known limitation of classic GWT under strict CSP, and acceptable if the application works correctly?
I’d like to keep CSP strict and avoid adding unsafe-inline.
Thanks!
Hi Craig, thanks for the response.
Yes, I tried the custom linker approach (GWT 2.12 + linker extending CrossSiteIframeLinker) earlier But my issue is not related to linker. GWT code splitting and script loading work correctly with nonce + strict-dynamic.
After further debugging, I realized the remaining CSP error is not coming from GWT’s linker or code splitting mechanism itself, but from Sencha GXT, specifically com.sencha.gxt.widget.core.client.form.FormPanel.
Using DOM inspection and a MutationObserver, I confirmed that FormPanel internally creates hidden iframes like:
This triggers the CSP console error under strict policies, even though the application functions correctly and all APIs return 200.
Now I want to confirm if there is any supported or tested way in GWT/GXT to:
Prevent FormPanel from using iframe src="javascript:''", or
Override/patch this behavior in a CSP-compliant way