GithubHelp home page GithubHelp logo

Drops charset declarations about dompurify HOT 9 CLOSED

cure53 avatar cure53 commented on July 4, 2024
Drops charset declarations

from dompurify.

Comments (9)

cure53 avatar cure53 commented on July 4, 2024

I am worried about allowing META tags in general, but I think <meta charset> might be doable.

Is there a specific use-case for this need? Or do you see a specific attack based on the omission of META elements?

from dompurify.

eoftedal avatar eoftedal commented on July 4, 2024

Definitely agree that allowing META tags in general is not something we should do.

I encountered this problem when converting a javascript byte array to a string and then running it through purify. I'll see if I can narrow down the testcase.

from dompurify.

eoftedal avatar eoftedal commented on July 4, 2024

This is weird. I have a file containing the norwegian letter ø
When the file size goes above 32786, the encoding breaks, and the ø becomes ø

Seems there also needs to be an image with a data:uri

from dompurify.

cure53 avatar cure53 commented on July 4, 2024

Same in different browsers?

from dompurify.

eoftedal avatar eoftedal commented on July 4, 2024

Ok, I've narrowed it down. I have only tested this in Chrome. See the following files: http://research.insecurelabs.org/encoding/

So between the diff between broken.html and works-because-meta.html is the meta header setting the character set. The difference between works.html and broken.html is a single line feed (\x0a).

In my version of Chrome, in broken.html ø becomes ø

Seems I can include a BOM in the HTML before running it through purify, and it will then work correctly.

from dompurify.

cure53 avatar cure53 commented on July 4, 2024

I am surprised though that the charset is lost under certain seemingly unrelated conditions.

My assumption was, that an HTML document created via document.implementation.createHTMLDocument inherits the charset from the creating document unless explicitly told otherwise (via META). What is doc.characterSet set to for the broken one?

from dompurify.

eoftedal avatar eoftedal commented on July 4, 2024

ISO-8859-1

from dompurify.

cure53 avatar cure53 commented on July 4, 2024

Strange. I believe it's a Chrome issue but I am not 100% sure. What's your take on this?

from dompurify.

eoftedal avatar eoftedal commented on July 4, 2024

Likely. I'll close this one

from dompurify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.