Skip to content

feat: add removeHTMLComments option #114

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

Merged
merged 1 commit into from
Apr 5, 2023
Merged

feat: add removeHTMLComments option #114

merged 1 commit into from
Apr 5, 2023

Conversation

fraxken
Copy link
Member

@fraxken fraxken commented Apr 2, 2023

Add a new option removeHTMLComments to remove any HTML comment from the provided source (or file).

Adding this as an option disabled by default because I'm not quite sure of the impact of this (and if this could be exploited in someway).

Should fixes #109

@fraxken fraxken requested a review from a team April 2, 2023 17:24
@@ -42,3 +42,7 @@
}
};
}

export function removeHTMLComment(str) {
return str.replace(/<!--[\s\S]*?(?:-->)/g, "");

Check failure

Code scanning / CodeQL

Incomplete multi-character sanitization

This string may still contain [<!--](1), which may cause an HTML element injection vulnerability.
Copy link
Member

@tony-go tony-go left a comment

Choose a reason for hiding this comment

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

LGTM % a bit of doc

@fraxken fraxken merged commit 1af1621 into master Apr 5, 2023
@PierreDemailly PierreDemailly deleted the html-comment branch April 5, 2023 19:05
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.

HTML Comment Parsing Error
3 participants