Skip to content

Unable to use Charts.js 2.7.0 as it requires CSP style directive unsafe-inline #161

@anand-bhat

Description

@anand-bhat

Site currently uses 2.6.0 and CSP style directive unsafe-inline is not allowed. However, upgrading to 2.7.0 or 2.7.1 (latest at this time) causes a CSP violation. This causes the chart not to appear.

chartjs/Chart.js#4591 introduced in 2.7.0 appears to be injecting CSS and causing the breakage --
<style type="text/css">/* Chart.js */ @-webkit-keyframes chartjs-render-animation{from{opacity:0.99}to{opacity:1}}@keyframes chartjs-render-animation{from{opacity:0.99}to{opacity:1}}.chartjs-render-monitor{-webkit-animation:chartjs-render-animation 0.001s;animation:chartjs-render-animation 0.001s;} </style>

I'll be retaining the library at 2.6.0 until I find a resolution for this or use a different library. Enabling unsafe-inline is not an option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions