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

JS prototype chain properties should not be treated as entities #370

Closed
karfau opened this issue Jan 27, 2022 · 0 comments · Fixed by #374
Closed

JS prototype chain properties should not be treated as entities #370

karfau opened this issue Jan 27, 2022 · 0 comments · Fixed by #374
Labels
bug Something isn't working
Milestone

Comments

@karfau
Copy link
Member

karfau commented Jan 27, 2022

Source code using in instead of Object.hasOwnProperty:

xmldom/lib/sax.js

Lines 68 to 69 in 40745c6

if(k in entityMap){
return entityMap[k];

import { DOMParser, XMLSerializer } from '@xmldom/xmldom';

const source = `<xml>&hasOwnProperty; &__proto__; &constructor;</xml>`;

const doc = new DOMParser({ errorHandler: console.error }).parseFromString(
  source,
  'text/xml'
);
console.log(
  doc.documentElement.toString()
);

leads to the output
<xml>function hasOwnProperty() { [native code] </xml>

Try it: https://stackblitz.com/edit/js-xmldom370?devtoolsheight=33&file=index.js

@karfau karfau added the bug Something isn't working label Jan 27, 2022
@karfau karfau added this to the 0.8.x milestone Jan 27, 2022
karfau added a commit to karfau/xmldom that referenced this issue Feb 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant