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

Add DOMPurify to sanitize HTML #196

Merged
merged 6 commits into from
Aug 12, 2021
Merged

Add DOMPurify to sanitize HTML #196

merged 6 commits into from
Aug 12, 2021

Conversation

tomap
Copy link
Contributor

@tomap tomap commented Aug 6, 2021

Non breacking new feature (disabled by default)

Will need a Minor version bump.

Once done, the plan is to enable it by default, to be safe by default :)

Non breacking new feature (disabled by default)
@coveralls
Copy link

coveralls commented Aug 6, 2021

Coverage Status

Coverage remained the same at 100.0% when pulling 5fe195b on tomap:fix/sanitize into 9edadff on hexojs:master.

README.md Outdated Show resolved Hide resolved
@tomap
Copy link
Contributor Author

tomap commented Aug 6, 2021

I should have added that it's a work in progress. Sorry for the trouble. Will deliver asap

@tomap
Copy link
Contributor Author

tomap commented Aug 6, 2021

Ready to be merged, no breacking change => just a minor bump :)

@tomap
Copy link
Contributor Author

tomap commented Aug 6, 2021

Could someone release v4.1.0 following the merge of this PR?

@yoshinorin
Copy link
Member

Could someone release v4.1.0 following the merge of this PR?

Please let me know.
I will release a new version :)

lib/renderer.js Outdated
Comment on lines 4 to 5
const createDOMPurify = require('dompurify');
const { JSDOM } = require('jsdom');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to only require dompurify when the option is enabled?

Suggested change
const createDOMPurify = require('dompurify');
const { JSDOM } = require('jsdom');
let JSDOM;
let createDOMPurify;
if (config.dompurify) {
createDOMPurify = require('dompurify');
JSDOM = require('jsdom').JSDOM;
}

This could speed up cold start performance.

Copy link
Member

@SukkaW SukkaW Aug 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, the suggestion here is just for demonstration. The require part should be added after the config is read.

@tomap

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

tomap and others added 4 commits August 7, 2021 22:19
Co-authored-by: Sukka <isukkaw@gmail.com>
@tomap tomap merged commit 6f6a774 into hexojs:master Aug 12, 2021
@tomap tomap deleted the fix/sanitize branch August 12, 2021 11:42
@tomap
Copy link
Contributor Author

tomap commented Aug 12, 2021

Could someone release v4.1.0 following the merge of this PR?

Please let me know.
I will release a new version :)

@yoshinorin you can create a release

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 this pull request may close these issues.

5 participants