Hi,
Currently if you use the Polaris.js from a script tag as is the recommended approach, there isn’t a documented integrity, nonce or hash that we can use.
This means we have to allow ‘unsafe-inline’ styles in a content security policy, which I would prefer to be able to lock down further
Hi @JordanFinners I reproduced this in a small Chrome test with s-box: its padding styles were blocked by the strict CSP. Polaris generates those inline <style> elements separately, so adding a nonce or integrity hash to the script tag doesn’t authorize them.
I haven’t verified a supported way to remove unsafe-inline for these styles with the current bundle. There’s a proposed change to address this, but it isn’t in the current polaris.js bundle yet.
Ah amazing! Thank you for looking into this, really appreciate it.
Would there be plans to add a integrity hash or nonce to Polaris and App Bridge in future as well? Jut to improve the security posture
@JordanFinners I checked on App Bridge, and there are currently no plans to publish integrity hashes or pass a CSP nonce through to the styles it generates.
The Polaris inline-style fix has now merged, but it isn’t in the public CDN bundles yet. I don’t have confirmed plans to share for integrity hashes or nonce support in Polaris.