Skip to content
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

Adding id as a valid attribute for amp-iframe #1147

Merged
merged 4 commits into from Jun 5, 2018
Merged

Adding id as a valid attribute for amp-iframe #1147

merged 4 commits into from Jun 5, 2018

Conversation

ghost
Copy link

@ghost ghost commented May 14, 2018

The id attribute of any iframe is being removed in the amp-iframe-sanitizer. I believed it's save to pass it as it's done with the classes, size, etc.

@@ -135,6 +136,7 @@ private function filter_attributes( $attributes ) {
case 'sandbox':
case 'class':
case 'sizes':
case 'id':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of just allowing id we should probably obtain all attributes that are allowed on amp-iframe, including data-* ones. For non-data-* attributes, the list of attributes can be obtained via AMP_Allowed_Tags_Generated::get_allowed_tag( 'amp-iframe' ). The list of globally-allowed attributes can be obtained via AMP_Allowed_Tags_Generated::get_allowed_attributes()...

On second thought, we it would be better to just copy all of the attributes over from the iframe because then the whitelist sanitizer can then report when invalid attributes are present, as opposed to silently stripping them out.

@westonruter westonruter added this to the v1.0 milestone May 18, 2018
…er will do the job

- remove scrolling from allowed attribute in amp-iframe
@ghost
Copy link
Author

ghost commented May 30, 2018

Following your advice I am just normalizing specific attributes in amp-iframe and letting AMP_Tag_And_Attribute_Sanitizer do the rest.

'scrolling' => array(
'value_regex' => 'auto|yes|no',
),

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change here? Any changes to this generated file should be done via amphtml-update.sh

westonruter added a commit that referenced this pull request May 30, 2018
Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juanchaur1 The change to class-amp-allowed-tags-generated.php is the only thing holding up this PR.

@ghost
Copy link
Author

ghost commented Jun 5, 2018

@westonruter I believe it's ready to be merge now 👍

@@ -161,7 +153,11 @@ private function filter_attributes( $attributes ) {
}
break;

case 'scrolling':
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juanchaur1 I don't think this is right because scrolling is allowed on amp-iframe:

https://github.com/ampproject/amphtml/blob/0a7e981cf65ef61394fe36f532c2b26a1b653606/extensions/amp-iframe/validator-amp-iframe.protoascii#L56-L58

In any case, it would be better to let the whitelist sanitizer remove it so that a validation error would be reported.

@westonruter westonruter merged commit 3443973 into ampproject:develop Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant