openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

`sap.m.ColorPalettePopover` violates `unsafe-eval` CSP

Open dfenerski opened this issue 2 years ago • 8 comments

OpenUI5 version: 1.108

Browser/version (+device/version): CR latest

Steps to reproduce the problem:

  1. Remove unsafe-eval from CSP header on the server
  2. Open DEV tools
  3. Click on the 'more colors' button of the sap.m.ColorPalettePopover

What is the expected result? Control should work as normal

What happens instead? The popover does not open

Any other information? (attach screenshot if possible) Error trace: image image i === 'sap.m.Slider': image

dfenerski avatar Apr 20 '23 13:04 dfenerski

Hello @dfenerski ,

Please send us link with isolated example with the issue.

Best Regards, Lidiya

LidiyaGeorgieva avatar Apr 20 '23 14:04 LidiyaGeorgieva

@dfenerski How are you serving the app? Is the app built, deployed, and launched from FLP? Does https://stackoverflow.com/a/74959324/5846045 help?

boghyon avatar May 10 '23 15:05 boghyon

Thanks for reaching out @boghyon! The app is built & minified, so CSP usually works. It is however served trough Express.js, so FLP settings do not apply for me.

I am somewhat sure the issue is caused by the inline import of sap.m.Slider here. I've managed to overcome the issue by extending the predefined control & defining the dependency manually in sap.ui.require and therefore removing the sync import.

Providing reproducible sample would require creating a dedicated code sandbox with express.js + openui5 skeleton, which I haven't found the time to do.

The tips you've listed in the stackoverflow table provide great insight regarding overall CSP guidelines. The point with sap.ui.core.IAsyncContentCreation is totally new for me - I have to research this one a bit.

dfenerski avatar May 10 '23 15:05 dfenerski

Hello @dfenerski, Thank you for sharing this finding. The issue is internally tracked with the Change-Id I713b517444b900847ce80fd9b37a5a9fbe709c34. The status of the issue will be updated here in GitHub.

i556484 avatar May 10 '23 18:05 i556484

[...] caused by the inline import of sap.m.Slider here.

Preparation for the global name removal: https://github.com/SAP/openui5/commit/a16ac4332b1b3d554c1815429f1a8f586e96d952

boghyon avatar Oct 09 '23 18:10 boghyon