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

Saniziting HTML attributes #66

Merged
merged 5 commits into from
Nov 9, 2020
Merged

Saniziting HTML attributes #66

merged 5 commits into from
Nov 9, 2020

Conversation

skitterm
Copy link
Contributor

@skitterm skitterm commented Nov 6, 2020

Overview

Data can now be sanitized before being put into HTML attribute values. Front-end frameworks like React have decent XSS protection for things injected as children elements, but not much protection for untrusted values being put into HTML attributes (like alt tag on image, href on anchor, style on div, background on body, etc).

Details

  • Wrapped js-xss's safeAttrValue() with a new instance method -- sanitizeHTMLAttribute(), which takes in the same parameters.
  • sanitizeHTMLAttribute() uses the custom safeAttrValue() if one is provided to the Sanitizer constructor

Changes

  • Updated this._xssFilter's type

@skitterm skitterm requested a review from ssylvia November 6, 2020 22:54
@ssylvia ssylvia merged commit 5dfc181 into master Nov 9, 2020
@ssylvia ssylvia deleted the html-attributes branch November 9, 2020 16:03
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.

2 participants