You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: explain CSP 'unsafe-eval' requirement when bootstrapping older UI5 releases
The default CSP no longer contains 'unsafe-eval'. Older UI5 releases
(e.g. 1.71) still execute modules via eval(), so bootstrapping them
fails with an EvalError. Document the symptom and how to re-add
'unsafe-eval' via the user exit, with a warning on the security page
and a pointer next to the bootstrap source table.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PHwMvvRGvLUV7CoLCB5A7e
Copy file name to clipboardExpand all lines: docs/configuration/security.md
+48-3Lines changed: 48 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ The frontend is a Single-Page Application (SPA) built with SAPUI5 or OpenUI5. Th
23
23
abap2UI5 never sends the app's business logic to the client. All business processes stay safely on the server, and sensitive data never reaches the frontend.
24
24
25
25
### Content-Security-Policy
26
-
To strengthen security, abap2UI5 uses a Content Security Policy (CSP) by default. CSP blocks attacks like cross-site scripting (XSS) and data injection by restricting which resources the browser can load. The default policy allows a fixed set of trusted sources — the SAP and OpenUI5 CDNs plus jsDelivr and cdnjs; the complete policy is shown below.
26
+
To strengthen security, abap2UI5 uses a Content Security Policy (CSP) by default. CSP blocks attacks like cross-site scripting (XSS) and data injection by restricting which resources the browser can load. The default policy allows a fixed set of trusted sources — the SAP and OpenUI5 CDNs plus jsDelivr and cdnjs; the complete policy is shown below. It deliberately does **not** contain `'unsafe-eval'`: current UI5 releases load all modules in a CSP-compliant way, so allowing `eval()` is unnecessary. If you bootstrap an older UI5 release, read [Bootstrapping Older UI5 Releases](#bootstrapping-older-ui5-releases) below.
27
27
28
28
#### Default CSP
29
29
By default, abap2UI5 uses the CSP below (defined in `z2ui5_cl_exit`):
@@ -38,12 +38,57 @@ By default, abap2UI5 uses the CSP below (defined in `z2ui5_cl_exit`):
38
38
```
39
39
40
40
#### Customizing the CSP
41
-
If needed, adjust the CSP by changing the HTTP handler call:
41
+
If needed, adjust the CSP in the [user exit](/advanced/extensibility/user_exits). The exit runs after the framework fills in the defaults, so whatever you set there overrides the default policy:
Older UI5 releases (for example `1.71`, the oldest supported version) still execute fetched modules via `eval()` in their module loader. The default CSP blocks `eval()`, so bootstrapping such a release fails: the page loads, but the component cannot start and the browser console shows an error like
53
+
54
+
```
55
+
Failed to load component for container container. Reason: EvalError: Evaluating a string as
56
+
JavaScript violates the following Content Security Policy directive because 'unsafe-eval' is
57
+
not an allowed source of script: default-src 'self' 'unsafe-inline' data: ui5.sap.com ...
58
+
```
59
+
60
+
Newer UI5 releases load modules without `eval()` and work with the default CSP out of the box — this error only appears with old releases.
61
+
62
+
To bootstrap an older release, override the CSP in the same exit where you set the bootstrap source and re-add `'unsafe-eval'` to `default-src` (or `script-src`). The example below is the default policy with only `'unsafe-eval'` added:
`'unsafe-eval'` weakens the protection CSP provides against cross-site scripting. Only add it when you must run a UI5 release that needs it, and remove it again once you upgrade to a newer release.
Copy file name to clipboardExpand all lines: docs/configuration/setup/ui5_bootstrapping.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,10 @@ Without an override, abap2UI5 uses the OpenUI5 cache-buster URL — i.e. the cur
29
29
|`/sap/public/bc/ui5_ui5/resources/sap-ui-core.js`| Locally hosted UI5 on the same SAP system |
30
30
|`https://ui5.sap.com/1.71/resources/sap-ui-core.js`| Oldest supported version |
31
31
32
+
::: warning Older releases need a CSP adjustment
33
+
The default Content Security Policy does not allow `eval()`, but the module loader of older UI5 releases (such as `1.71`) still relies on it. Bootstrapping such a release with the default CSP fails with an `EvalError` in the browser console ("Failed to load component for container container"). Re-add `'unsafe-eval'` to the CSP in the same exit where you set the bootstrap source — see [Bootstrapping Older UI5 Releases](/configuration/security#bootstrapping-older-ui5-releases).
34
+
:::
35
+
32
36
### OpenUI5 vs SAPUI5
33
37
34
38
-**OpenUI5** (`sdk.openui5.org`) is the Apache-licensed open-source subset of UI5. It contains all libraries a typical abap2UI5 app uses: `sap.m`, `sap.ui.core`, `sap.ui.layout`, `sap.ui.table`, `sap.ui.unified`, `sap.uxap`, `sap.f`, `sap.tnt`, `sap.viz`.
0 commit comments