Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with secure CSP #8

Open
lol768 opened this issue Feb 26, 2020 · 3 comments · May be fixed by #22
Open

Incompatible with secure CSP #8

lol768 opened this issue Feb 26, 2020 · 3 comments · May be fixed by #22

Comments

@lol768
Copy link

lol768 commented Feb 26, 2020

qrcode-svg/lib/qrcode.js

Lines 312 to 317 in 47d56ec

//Populate with predefined shape instead of "rect" elements, thanks to @kkocdko
var predefined = typeof options.predefined != "undefined" ? !!options.predefined : false;
var defs = predefined ? indent + '<defs><path id="qrmodule" d="M0 0 h' + ysize + ' v' + xsize + ' H0 z" style="fill:' + options.color + ';shape-rendering:crispEdges;" /></defs>' + EOL : '';
//Background rectangle
var bgrect = indent + '<rect x="0" y="0" width="' + width + '" height="' + height + '" style="fill:' + options.background + ';shape-rendering:crispEdges;"/>' + EOL;

Please don't do this, for those of us using this library on the web it will break on every sufficiently secured site which doesn't allow script-src 'unsafe-inline'.

For setting the fill colour, there's a perfectly good fill attribute you can use instead. For e.g. the crisp edges rendering, please just put the CSS in the README and let us apply it ourselves

@qoomon
Copy link

qoomon commented May 15, 2020

Can you explain which part will cause the csp violation, cause I cant locate the inline script. Is it because of the style attribute?

@lol768
Copy link
Author

lol768 commented May 15, 2020

Please don't do this, for those of us using this library on the web it will break on every sufficiently secured site which doesn't allow script-src 'unsafe-inline'.

Should read:

Please don't do this, for those of us using this library on the web it will break on every sufficiently secured site which doesn't allow style-src 'unsafe-inline'.

Apologies

@qubyte qubyte linked a pull request Nov 9, 2021 that will close this issue
@qubyte
Copy link

qubyte commented Nov 9, 2021

crisp-edges is also an attribute in SVG. I've opened a PR to address both: #22.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants