amcharts / amcharts5

The newest, fastest, and most advanced amCharts charting library for JavaScript and TypeScript apps.
Other
345 stars 92 forks source link

Nonce does not work with StockChart #1655

Closed lcuone closed 1 month ago

lcuone commented 1 month ago

Setting the nonce does not work with StockChart and produces an error when working without "unsafe-inline" in CSP rules. let root = am5.Root.new("some-id", {"nonce": "some-nonce"});

Further details should not be necessary since it's obvious that the nonce is not passed as 4th parameter here:

https://github.com/amcharts/amcharts5/blob/2899773c08838de20090dbab4ba9cb441f1cf4ab/src/.internal/core/util/Modal.ts#L28

While StyleRule itself has the parameter implemented:

https://github.com/amcharts/amcharts5/blob/2899773c08838de20090dbab4ba9cb441f1cf4ab/src/.internal/core/util/Utils.ts#L462C14-L462C114

martynasma commented 1 month ago

Technically, you need to set nonce as a property of Root:

let root = am5.Root.new("some-id");
root.nonce = "some-nonce";

That being said, not all stylesheets were being populated with this nonce, including Modal's.

We'll fix it in the next version. Will ping you here when it's out.

Thanks!

martynasma commented 1 month ago

Fixed in 5.10.1.

[5.10.1] - 2024-08-09

Added

Changed

Fixed

Full change log.

Download options.

Make sure you clear your browser cache after upgrading. And feel free to contact us again if you are still experiencing this issue.