-
Notifications
You must be signed in to change notification settings - Fork 384
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
Leaked validation errors for implicit layout "container" without width/height #4465
Comments
It looks like this is not part of the protoascii specs, but hard-coded logic within the validator(s): https://github.com/ampproject/amphtml/blob/6eb58814bebd917d3665ccf81f9db4cf641415c5/validator/engine/validator.js#L4124 |
This has nothing to do with The reason for the validation error is that a missing layout falls back to the implicit layout "container", and that implicit layout requires |
That doesn't seem to be quite right, as |
Yes, I misphrased this. From the validator:
|
It seems we need to implement that entire code block in |
I could reproduce 15 out of 17 test failures in the official validator and fix by adding The two remaining test failures are related to |
I think the two remaining test failures are because we are also missing this part of the logic: https://github.com/ampproject/amphtml/blob/6eb58814bebd917d3665ccf81f9db4cf641415c5/validator/engine/validator.js#L4045-L4054 So, validating the layout should be skipped as soon as template syntax is discovered. |
Ah, I forgot we already skip sanitization completely through this code: https://github.com/ampproject/amp-wp/pull/3243/files#diff-ee41b32e64c90445a71328ca93cfa799R1005-R1009 I'll have to find another culprit then... |
Here's what I've got for the two remaining test failures.
My current conclusion is that our interpretation (throw a @westonruter, @sebastianbenz Is this plausible? Are you able to confirm this internally? |
@schlessera sounds reasonable. @caroqliu to confirm. |
Looks like cc @ampproject/wg-caching |
Correct. But the spec in the plugin is a bit stale. I have a pending PR to update it to 2004041903580 which will add this So the validator spec should actually be deleting |
Yes, in the line referenced above as well as here and here. This commit specifically covers the extent of the validator changes that should be undone. |
Bug Description
Given this markup in a Custom HTML block:
This is leaking a validation error to the frontend:
I thought that this would have been prevented by #3728.
This was discovered in a support topic.
Expected Behaviour
AMP components that have neither a
layout
norwidth
/height
attributes should be removed entirely. An appropriate validation error should be raised in the plugin.The corresponding AMP validation error constant is
MISSING_LAYOUT_ATTRIBUTES
.Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation brief
QA testing instructions
Demo
Before
The plugin's validation doesn't show any errors for the post.
However, the AMP validator complains about the post.
After
The plugin's validation catches the two offending elements and removes them.
The validation issues are not leaked into the AMP validator anymore.
Changelog entry
The text was updated successfully, but these errors were encountered: