postcss-url causes CSP valolation when url is set to 'inline'
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- build-system
Research direction
Start with the provided PostCSS configuration, especially the postcss-url setting url: "inline", and compare development output with the built main.195fbc3377ced840.js under the reported Content Security Policy. Reproduce the browser violation and determine what behavior is expected when assets are embedded; done means the built output no longer triggers the reported CSP error.
Written by the indexing model from the issue text.
Description
I want to embed my font and image files into my js file using postcss-url.
Here is my postcss config:
module.exports = {
plugins: {
tailwindcss: {
config: join(__dirname, 'tailwind.config.js'),
},
autoprefixer: {},
cssnano: {},
'postcss-import': {},
'postcss-url': {
url: "inline",
maxSize: 128 * 1024,
useHash: true,
}
},
};
Everything works fine in development mode. But when I moved built files to the server, I faced this error in browser:
main.195fbc3377ced840.js:2 Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.
- Dominant language
- JavaScript
- Stars
- 383
- Forks
- 58
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from postcss/postcss-url
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
postcss/postcss-url#183 · 1 comment · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
postcss/postcss-url#181 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
postcss/postcss-url#180 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
postcss/postcss-url#179 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
postcss/postcss-url#177 · 1 comment ·
All issues in postcss/postcss-url
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·