Add innerHtml function to enable inserting arbitrary HTML#4
Conversation
|
+1 from me cc @elm-community/packages |
|
update comment to note that it doesn't convert them to vdom nodes |
|
@eeue56 Good call. Added, squashed, and force pushed. WDYT? |
|
Seems like a security hole, worth documenting? |
|
Probably worth a caution about "untrusted input" ... that is, you wouldn't want to insert |
|
Struggling with the best way to word this. Perhaps appending "Also note that passing untrusted input to this function could enable XSS attacks."? |
|
I'm not sure it should necessarily fall on this package to document that concern. This function is just a wrapper for something you can already do and folks are already doing with elm-html. |
|
I would even go further and suggest that the property name should be changed to indicate the security risks, naming it |
|
On the theory that some action is better than inaction, I'm going to merge this and then add a security warning to the docs. |
|
Looks good to me. Thanks, Max! |
|
One other idea occurs to me -- it may be overkill (in fact, it probably is overkill). Ruby has this concept of things being "tainted" or "trusted", in order to mark whether they come from. We could adapt that idea to the type signature. One version would be something like this: This would actually be fairly non-intrusive to the caller, since you could still provide a plain-old-String ... the The other approach would be to actually make type Trusted a =
Trusted a
trust : a -> Trusted a
trust = Trusted
extract : Trusted a -> a
extract trusted =
case trusted of
Trusted a -> aThen, the type signature would be something like: So, this would be more intrusive, in the sense that you'd have to explicitly trust your strings, but in a way that's also it's benefit. So, I just throw it out there as a possible idea -- as I say, it may well be overkill. |
|
Yeah, I've actually been thinking about the same thing... that Rails' Probably out of the scope of this PR, but it's definitely something I've On Mon, Apr 11, 2016, 9:31 AM Ryan Rempel notifications@github.com wrote:
|
|
I wrote up an issue re: using types for trusted string, for further discussion: #5 |
Howdy!
I've copying and pasting this little gem around for a few projects now, so I think its time to extract it into its own package. I think it might be broadly useful enough to warrant inclusion in this package. What do you think?