Conversation
72622cc to
0022cfd
Compare
Collaborator
|
@jimmyhchan this could be interesting |
src/runtime.js
Outdated
Collaborator
There was a problem hiding this comment.
we may have to repeat this key a bunch of times. a[href], img[src]. is there a way to gather a bunch of contexts to filter on.
Owner
Author
There was a problem hiding this comment.
We could pretty easily define a single function and then assign it to multiple contexts:
function anchorsAndImages (val) {
...
}
attrFilters: {
'a[href]': anchorsAndImages,
'img[src]': anchorsAndImages
}
I was also thinking of having some more generic rules. For example, 'a' would match all attributes in an anchor tag, and '[src]' would match src attributes on any tag. That leads to a few questions:
- If multiple filters are found for a single attribute, are they all executed or just the most specific?
- If they are all executed, in what order are they executed? From most specific to least specific? Random?
Experimental: Allow attribute values to be filtered before being
attached to an element. This should prevent something like:
```
<a href="{customUrl}">Click me</a>
```
from being an XSS hole with a context like:
```
{
customUrl: "javascript:alert('hacked')"
}
```
Owner
Author
|
So, even with the new compiler, I think we need to put something in the runtime, because we won't know until runtime if attributes with UGC need to be filtered. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Experimental: Allow attribute values to be filtered before being
attached to an element. This should prevent something like:
from being an XSS hole with a context like: