-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[Validator] Template attribute values in data-*
attributes not validated
#3460
Comments
data-*
attributes not validateddata-*
attributes not validated
/to @Gregable I'd indeed expect the same partial/unescaping rules to apply to data attributes as well. That being said, the validation of templates is mainly aimed to "inform" of potential pitfalls when using templates. The results of template execution are still pushed via HTML sanitizer as well. |
This is a legitimate bug, the data-* attributes take a slightly different code path through the validator due to being 'wildcard' attribute names, and aren't getting run through the template validation. As Dima said though, our primary goal in validation is to make sure that the pre-mustache-rendered document doesn't break amp validation rules. The post-mustache-rendered doc will be validated separately (currently via a runtime sanitizer) and also needs to be valid amp. The unescaped/partials logic is there to provide developer hints. |
… are data-* attributes (See related: ampproject/amphtml#3460 )
…taining template escapes/partials (See related: ampproject/amphtml#3460 )
@Gregable Slotting in backlog, but feel free to correct/update the milestone as needed |
Resolved. This will be deployed to cdn.ampproject.org next week. |
The following template attribute values correctly generate validation errors:
These errors are triggered by the
validateAttrValueBelowTemplateTag()
Interestingly, the following will not trigger any validation error:
This is because all
data-*
attribute values are not validated at all. (data-*
attribute names are validated though). (seevalidateAttrNotFoundInSpec()
)Is this behaviour correct? Should we not check
data-*
values also whether they have a correct value if they are underneath template tags?This seems to contradict the comment "We disallow these in attribute values" (see below)
Another contradiction: "We disallow partials in attribute values" as partials are allowed in
data-*
(see below)The text was updated successfully, but these errors were encountered: