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

Document safety of handling user input (like JSX escaping) #10

Open
kumar303 opened this issue Oct 16, 2019 · 7 comments
Open

Document safety of handling user input (like JSX escaping) #10

kumar303 opened this issue Oct 16, 2019 · 7 comments

Comments

@kumar303
Copy link

JSX provides automatic escaping which lets you put user input into JSX safely (and without thinking about it).

Does esx provide this under the hood? I was unsure when looking through the ES6 template string examples so it would be helpful to document this in the readme.

@davidmarkclements
Copy link
Member

yes it does - all inputs run through here https://github.com/esxjs/esx/blob/master/lib/escape.js

@davidmarkclements
Copy link
Member

would love a PR for this if you're into it

@kumar303
Copy link
Author

I suggest also mentioning in the docs that it uses custom escaping code, rather than the official React escaping code (just for transparency).

@davidmarkclements
Copy link
Member

no it's supposed to match the escape codes in React, that's why it's duplicated rather than just using escape-html as mentioned here: https://github.com/esxjs/esx/blob/master/lib/escape.js#L3-L8

are you saying it doesn't? if so that should be fixed

@kumar303
Copy link
Author

are you saying it doesn't? if so that should be fixed

I just meant that the docs should mention how esx uses its own escaping code rather than using the exact React escaping code. This is an important detail because a potential security bug that gets fixed upstream in React (in the future) would not make it into esx unless it was manually copied over (if I understand correctly).

@davidmarkclements
Copy link
Member

yes I see what you're saying. It corresponds exactly right now. It's terribly annoying that react didn't just use the escape-html module or release their own.

Would you be interested in making a PR?

@kumar303
Copy link
Author

yes I see what you're saying. It corresponds exactly right now. It's terribly annoying that react didn't just use the escape-html module or release their own.

I suggest filing an issue asking them to make it importable so you can at least call the same function.

Would you be interested in making a PR?

I can add it to my to-do list but I probably won't get to it any time soon.

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

No branches or pull requests

2 participants