-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
Add a new html_input
option
#255
Conversation
What I first wanted to do is to remove the Maybe it would make sense to have "getters" for each option value on the |
Fixes thephpleague#253. The new `html_input` option allows 3 different behaviors: - `strip` HTML input - `allow` HTML input - `escape` HTML input
45f4bf2
to
3c25037
Compare
FYI I have opened a discussion on Reddit about "how secure" escaping HTML could be: https://fr.reddit.com/r/PHP/comments/4qbf4g/improving_handling_of_untrusted_html_input_in/ |
I'm wondering if maybe we need 4 options:
|
That's fine. I'd be okay tackling that afterwards (as a separate PR).
Its possible for other developers to create extensions which have their own configuration options. I don't know if your proposed change might lead them to think they must extend
How about
I like the idea of constants. Perhaps we can put them on |
Thinking out loud again: Putting the constants on |
As a user they would be much easier to find on the Environment class.
Could make sense but it would mean requiring that package as a dependency. Also users can run the whole generated HTML (from CommonMark) into HTMLPurifier themselves, the only advantage of integrating it directly into this library is more guidance for users. However that could also be solved with the documentation: explain that
Sounds good, I'll have a look at it tonight. |
See thephpleague#253 and thephpleague#255. The `safe` option is now deprecated in favor of the `allow_unsafe_links` and `html_input` options. The `allow_unsafe_links` is `true` by default for BC reasons.
I have pushed a new commit to add a new |
… option That will make the HTML output much simpler and easier to read, and also more compact. See https://fr.reddit.com/r/PHP/comments/4qbf4g/improving_handling_of_untrusted_html_input_in/d4te6ms?context=3
FYI I've replaced This PR should be good for review now. |
This looks perfect to me! Thank you so much for implementing this. I'll release a new version with this change momentarily. |
0.14.0 has been released with this change! The new options have been added to the documentation's Configuration page. I've also created a Security page encouraging users to use this new option. Thanks again for implementing this! |
Awesome thanks for the quick merge. I had no idea where the documentation was, it's a separate repository? |
Ohh I didn't even think about checking that, thanks! |
See #253, this is still WIP. That was easier than I thought, however I think it will require some more thinking. I'm pushing it "as-is" so that we can progress on what to do:
Environment
class make sense to you?Feel free to send any other comment about the code, including small coding style stuff, I don't mind at all.
The new
html_input
option allows 3 different behaviors:strip
HTML inputallow
HTML inputescape
HTML input