-
Notifications
You must be signed in to change notification settings - Fork 346
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
feat: Configure Mozilla's Eslint Plugin eslint-plugin-no-unsanitized + DOMPurify.sanitize + escapeHtml #416
base: main
Are you sure you want to change the base?
Conversation
results of aem-psi-check would be necessary here. |
@fkakatie completely agree. It looks like there's a problem with my fork, because when I access https://xss-lint-dompurify--helix-project-boilerplate--andreituicu.aem.live the head doesn't have any scripts/css... Could I possibly get write permissions to the boilerplate? That way I can create the branches directly in the project and recreate the PRs including PSI values. |
@@ -22,7 +22,8 @@ export async function loadFragment(path) { | |||
const resp = await fetch(`${path}.plain.html`); | |||
if (resp.ok) { | |||
const main = document.createElement('main'); | |||
main.innerHTML = await resp.text(); | |||
|
|||
main.innerHTML = DOMPurify.sanitize(await resp.text()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the original fragment
block source is in the block-collection and should probably be fixed there first, then updated here.
@@ -537,7 +537,7 @@ function buildBlock(blockName, content) { | |||
vals.forEach((val) => { | |||
if (val) { | |||
if (typeof val === 'string') { | |||
colEl.innerHTML += val; | |||
colEl.textContent += val; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the aem.js
source is here and the build result gets copied to the boilerplate.
.replaceAll('"', '"') | ||
.replaceAll('\'', '''); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe something for aem.js?
@rofe I agree with your suggestions of moving different changes into I'm not 100% convinced it is simple enough for developers (which I might be wrong) when they should escape, when they should sanitize and when are both needed. Using any of them will make the linter happy, but depending on context they aren't both secure, or said differently, each offers protection in specific cases. I'm not sure if it would be a better approach to just keeping it simple by saying that any use of unsafe API is unsafe. |
Interesting results |
Deep PSI said: |
Building on top of #415
Test urls: