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

fix #245 #253

Merged
merged 1 commit into from
May 27, 2022
Merged

fix #245 #253

merged 1 commit into from
May 27, 2022

Conversation

lumburr
Copy link
Contributor

@lumburr lumburr commented Mar 12, 2022

fix #245

Case A

<span class=\"preference__text--green text--bold\">BP</span>

  • before this PR : class and text--bold
  • after : class and text--bold\

Case B

<span class= "preference__text--green text--bold">BP</span>

  • before this PR : class and text--bold
  • after : class

dist/xss.js Outdated Show resolved Hide resolved
dist/xss.js Outdated Show resolved Hide resolved
dist/xss.js Outdated Show resolved Hide resolved
dist/xss.js Outdated Show resolved Hide resolved
throw new Error();
}
}
);
debug(html);
assert.equal(
html,
'href="#" attr1="b" attr2="c" attr3 attr4="value4&quote;" attr5'
'href="#" attr1="b" attr2="c" attr3 attr4="value4&quote;" attr5 attr6\\ attr7="123 456"'
Copy link
Owner

Choose a reason for hiding this comment

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

这里结果不太符合预期,attr6\\ 应该为 attr6\\"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这是因为正则var REGEXP_ILLEGAL_ATTR_NAME = /[^a-zA-Z0-9\\_:.-]/gim会对属性字符串过滤,双引号不在有效的属性符号内,所以被过滤掉了,这个PR理论上不涉及这个正则的逻辑更改

Copy link
Contributor Author

Choose a reason for hiding this comment

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

如果你需要把双引号认为是合法的属性字符的话,我可以继续更改这个PR

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.

class is wrong separated by attributes in method onTagAttr
2 participants