Repository navigation
fix: drop style-src 'unsafe-inline' from the CSP - #22
Merged
Merged
Conversation
The five inline styles of each language page and the one in the demo step markup (sanad-core.js) move into sanad.css. The favicon keeps its <style>, allowed by its sha256 hash. tools/check-site.mjs now fails on a style attribute in a page or in script-built markup, a <style> in a page, and an SVG <style> whose hash is missing from the CSP. Closes #7 Signed-off-by: xnosir <283333996+xnosir@users.noreply.github.com>
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
styleattributes each),sanad-core.jsstep markup,sanad.css,deploy/Caddyfile,tools/check-site.mjs, docsProblem
The CSP allowed
style-src 'unsafe-inline'for a fewstyleattributes (residual risk indocs/ASSURANCE.md). The demo also built step icons withstyle="position:absolute"insanad-core.js.Change
.src--meta,.tg-copy h2,.tg-copy h2 + .lead,.traveller,.traveller__card); step icon to.steps .st .i-x.style-src 'self' 'sha256-y8K5...'(the favicon<style>, dark-mode colours).check-site.mjsfails on astyleattribute in pages or script-built markup, a<style>in pages, and an SVG<style>whose hash is not in the CSP.Proof
/,/en/,/ru/#meta0 18 16,#h-tg58.88px/14px, lead 20px, card fillrgb(248,243,228)sanad-core.jsfix)npm test(43 unit + 29 e2e + coverage gate)npm run lintcheck-sitenegative test (oldsanad-core.js)