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

AMP4Email: Disallow "latest" extension scripts #24854

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion extensions/amp-accordion/validator-amp-accordion.protoascii
Expand Up @@ -16,7 +16,6 @@
tags: { # amp-accordion
html_format: AMP
html_format: AMP4ADS
html_format: AMP4EMAIL
html_format: ACTIONS
tag_name: "SCRIPT"
extension_spec: {
Expand All @@ -28,6 +27,19 @@ tags: { # amp-accordion
}
attr_lists: "common-extension-attrs"
}
tags: { # amp-accordion
html_format: AMP4EMAIL
tag_name: "SCRIPT"
spec_name: "SCRIPT[custom-element=amp-accordion] (AMP4EMAIL)"
extension_spec: {
name: "amp-accordion"
# AMP4EMAIL doesn't allow version: "latest".
version: "0.1"
requires_usage: GRANDFATHERED
deprecated_allow_duplicates: true
}
attr_lists: "common-extension-attrs"
}
tags: { # <amp-accordion>
html_format: AMP
html_format: AMP4ADS
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-anim/validator-amp-anim.protoascii
Expand Up @@ -34,8 +34,8 @@ tags: { # amp-anim
spec_name: "amp-anim extension .js script (AMP4EMAIL)"
extension_spec: {
name: "amp-anim"
# AMP4EMAIL doesn't allow version: "latest".
version: "0.1"
version: "latest"
}
attr_lists: "common-extension-attrs"
}
Expand Down
16 changes: 15 additions & 1 deletion extensions/amp-bind/validator-amp-bind.protoascii
Expand Up @@ -16,7 +16,6 @@
tags: { # amp-bind
html_format: AMP
html_format: AMP4ADS
html_format: AMP4EMAIL
html_format: ACTIONS
tag_name: "SCRIPT"
extension_spec: {
Expand All @@ -30,6 +29,21 @@ tags: { # amp-bind
}
attr_lists: "common-extension-attrs"
}
tags: { # amp-bind
html_format: AMP4EMAIL
tag_name: "SCRIPT"
spec_name: "SCRIPT[custom-element=amp-bind] (AMP4EMAIL)"
extension_spec: {
name: "amp-bind"
# AMP4EMAIL doesn't allow version: "latest"
version: "0.1"
# amp-bind has no associated tag which indicates usage of the extension.
# TODO(gregable): Implement a mechanism to associate attributes with
# extension usage and then set this to GRANDFATHERED or ERROR.
requires_usage: NONE
}
attr_lists: "common-extension-attrs"
}
tags: { # <amp-state> (json)
html_format: AMP
html_format: AMP4ADS
Expand Down
1 change: 1 addition & 0 deletions extensions/amp-carousel/validator-amp-carousel.protoascii
Expand Up @@ -35,6 +35,7 @@ tags: { # amp-carousel for AMP4EMAIL
spec_name: "SCRIPT[custom-element=amp-carousel] (AMP4EMAIL)"
extension_spec: {
name: "amp-carousel"
# AMP4EMAIL doesn't allow version: "latest".
version: "0.1"
}
attr_lists: "common-extension-attrs"
Expand Down
16 changes: 16 additions & 0 deletions extensions/amp-fit-text/validator-amp-fit-text.protoascii
Expand Up @@ -29,6 +29,22 @@ tags: { # amp-fit-text
}
attr_lists: "common-extension-attrs"
}
tags: { # amp-fit-text
html_format: AMP
html_format: AMP4ADS
html_format: AMP4EMAIL
html_format: ACTIONS
tag_name: "SCRIPT"
spec_name: "SCRIPT[custom-element=amp-fit-text] (AMP4EMAIL)"
extension_spec: {
name: "amp-fit-text"
# AMP4EMAIL doesn't allow version: "latest".
version: "0.1"
requires_usage: GRANDFATHERED
deprecated_allow_duplicates: true
}
attr_lists: "common-extension-attrs"
}
tags: { # <amp-fit-text>
html_format: AMP
html_format: AMP4ADS
Expand Down
14 changes: 13 additions & 1 deletion extensions/amp-form/validator-amp-form.protoascii
Expand Up @@ -18,7 +18,6 @@ tags: { # amp-form
# under section "4.10 Forms"
html_format: AMP
html_format: AMP4ADS
html_format: AMP4EMAIL
html_format: ACTIONS
tag_name: "SCRIPT"
extension_spec: {
Expand All @@ -30,3 +29,16 @@ tags: { # amp-form
}
attr_lists: "common-extension-attrs"
}
tags: { # amp-form
html_format: AMP4EMAIL
tag_name: "SCRIPT"
spec_name: "SCRIPT[custom-element=amp-form] (AMP4EMAIL)"
extension_spec: {
name: "amp-form"
# AMP4EMAIL doesn't allow version: "latest".
version: "0.1"
deprecated_allow_duplicates: true
requires_usage: GRANDFATHERED
}
attr_lists: "common-extension-attrs"
}
2 changes: 1 addition & 1 deletion extensions/amp-list/validator-amp-list.protoascii
Expand Up @@ -31,8 +31,8 @@ tags: { # amp-list
spec_name: "SCRIPT[custom-element=amp-list] (AMP4EMAIL)"
extension_spec: {
name: "amp-list"
# AMP4EMAIL doesn't allow version: "latest".
version: "0.1"
version: "latest"
}
attr_lists: "common-extension-attrs"
}
Expand Down
19 changes: 16 additions & 3 deletions extensions/amp-mustache/validator-amp-mustache.protoascii
Expand Up @@ -36,10 +36,9 @@ tags: { # amp-mustache
}
tags: { # amp-mustache
html_format: AMP4ADS
html_format: AMP4EMAIL
html_format: ACTIONS
tag_name: "SCRIPT"
spec_name: "SCRIPT[custom-element=amp-mustache] (AMP4ADS/AMP4EMAIL)"
spec_name: "SCRIPT[custom-template=amp-mustache] (AMP4ADS/ACTIONS)"
extension_spec: {
name: "amp-mustache"
extension_type: CUSTOM_TEMPLATE
Expand All @@ -50,7 +49,21 @@ tags: { # amp-mustache
}
attr_lists: "common-extension-attrs"
}
# The script element.
tags: { # amp-mustache
html_format: AMP4EMAIL
tag_name: "SCRIPT"
spec_name: "SCRIPT[custom-template=amp-mustache] (AMP4EMAIL)"
extension_spec: {
name: "amp-mustache"
extension_type: CUSTOM_TEMPLATE
# AMP4EMAIL doesn't allow version: "latest".
version: "0.1"
version: "0.2"
deprecated_version: "0.1"
}
attr_lists: "common-extension-attrs"
}
# Templates using script[type=text/plain].
tags: {
html_format: AMP
html_format: AMP4ADS
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-selector/validator-amp-selector.protoascii
Expand Up @@ -32,8 +32,8 @@ tags: {
spec_name: "SCRIPT[custom-element=amp-selector] (AMP4EMAIL)"
extension_spec: {
name: "amp-selector"
# AMP4EMAIL doesn't allow version: "latest".
version: "0.1"
version: "latest"
requires_usage: GRANDFATHERED
}
attr_lists: "common-extension-attrs"
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-sidebar/validator-amp-sidebar.protoascii
Expand Up @@ -32,8 +32,8 @@ tags: { # amp-sidebar
tag_name: "SCRIPT"
extension_spec: {
name: "amp-sidebar"
# AMP4EMAIL doesn't allow version: "latest".
version: "0.1"
version: "latest"
}
attr_lists: "common-extension-attrs"
}
Expand Down
11 changes: 10 additions & 1 deletion extensions/amp-timeago/validator-amp-timeago.protoascii
Expand Up @@ -16,7 +16,6 @@

tags: { # amp-timeago
html_format: AMP
html_format: AMP4EMAIL
html_format: ACTIONS
tag_name: "SCRIPT"
extension_spec: {
Expand All @@ -26,6 +25,16 @@ tags: { # amp-timeago
}
attr_lists: "common-extension-attrs"
}
tags: { # amp-timeago
html_format: AMP4EMAIL
tag_name: "SCRIPT"
extension_spec: {
name: "amp-timeago"
# AMP4EMAIL doesn't allow version: "latest".
version: "0.1"
}
attr_lists: "common-extension-attrs"
}
tags: { # <amp-timeago>
html_format: AMP
html_format: AMP4EMAIL
Expand Down
@@ -0,0 +1,41 @@
<!--
Copyright 2015 The AMP HTML Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the license.
-->
<!--
Test Description:
This checks that "latest" versions of extensions are not valid.
-->
<!doctype html>
<html ⚡4email>
<head>
<meta charset="utf-8">
<style amp4email-boilerplate>body{visibility:hidden}</style>
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-accordion" src="https://cdn.ampproject.org/v0/amp-accordion-latest.js"></script>
<script async custom-element="amp-anim" src="https://cdn.ampproject.org/v0/amp-anim-latest.js"></script>
<script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-latest.js"></script>
<script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-latest.js"></script>
<script async custom-element="amp-fit-text" src="https://cdn.ampproject.org/v0/amp-fit-text-latest.js"></script>
<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-latest.js"></script>
<script async custom-element="amp-list" src="https://cdn.ampproject.org/v0/amp-list-latest.js"></script>
<script async custom-element="amp-selector" src="https://cdn.ampproject.org/v0/amp-selector-latest.js"></script>
<script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-latest.js"></script>
<script async custom-element="amp-timeago" src="https://cdn.ampproject.org/v0/amp-timeago-latest.js"></script>
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-latest.js"></script>
</head>
<body>
Hello, world.
</body>
</html>
@@ -0,0 +1,74 @@
FAIL
| <!--
| Copyright 2015 The AMP HTML Authors. All Rights Reserved.
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS-IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the license.
| -->
| <!--
| Test Description:
| This checks that "latest" versions of extensions are not valid.
| -->
| <!doctype html>
| <html ⚡4email>
| <head>
| <meta charset="utf-8">
| <style amp4email-boilerplate>body{visibility:hidden}</style>
| <script async src="https://cdn.ampproject.org/v0.js"></script>
| <script async custom-element="amp-accordion" src="https://cdn.ampproject.org/v0/amp-accordion-latest.js"></script>
>> ^~~~~~~~~
amp4email_feature_tests/no_latest_extensions.html:26:2 The attribute 'src' in tag 'SCRIPT[custom-element=amp-accordion] (AMP4EMAIL)' is set to the invalid value 'https://cdn.ampproject.org/v0/amp-accordion-latest.js'. (see https://amp.dev/documentation/components/amp-accordion) [DISALLOWED_HTML]
| <script async custom-element="amp-anim" src="https://cdn.ampproject.org/v0/amp-anim-latest.js"></script>
>> ^~~~~~~~~
amp4email_feature_tests/no_latest_extensions.html:27:2 The attribute 'src' in tag 'amp-anim extension .js script (AMP4EMAIL)' is set to the invalid value 'https://cdn.ampproject.org/v0/amp-anim-latest.js'. (see https://amp.dev/documentation/components/amp-anim) [DISALLOWED_HTML]
| <script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-latest.js"></script>
>> ^~~~~~~~~
amp4email_feature_tests/no_latest_extensions.html:28:2 The attribute 'src' in tag 'SCRIPT[custom-element=amp-bind] (AMP4EMAIL)' is set to the invalid value 'https://cdn.ampproject.org/v0/amp-bind-latest.js'. (see https://amp.dev/documentation/components/amp-bind) [DISALLOWED_HTML]
| <script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-latest.js"></script>
>> ^~~~~~~~~
amp4email_feature_tests/no_latest_extensions.html:29:2 The attribute 'src' in tag 'SCRIPT[custom-element=amp-carousel] (AMP4EMAIL)' is set to the invalid value 'https://cdn.ampproject.org/v0/amp-carousel-latest.js'. (see https://amp.dev/documentation/components/amp-carousel) [DISALLOWED_HTML]
| <script async custom-element="amp-fit-text" src="https://cdn.ampproject.org/v0/amp-fit-text-latest.js"></script>
| <script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-latest.js"></script>
>> ^~~~~~~~~
amp4email_feature_tests/no_latest_extensions.html:31:2 The attribute 'src' in tag 'SCRIPT[custom-element=amp-form] (AMP4EMAIL)' is set to the invalid value 'https://cdn.ampproject.org/v0/amp-form-latest.js'. (see https://amp.dev/documentation/components/amp-form) [DISALLOWED_HTML]
| <script async custom-element="amp-list" src="https://cdn.ampproject.org/v0/amp-list-latest.js"></script>
>> ^~~~~~~~~
amp4email_feature_tests/no_latest_extensions.html:32:2 The attribute 'src' in tag 'SCRIPT[custom-element=amp-list] (AMP4EMAIL)' is set to the invalid value 'https://cdn.ampproject.org/v0/amp-list-latest.js'. (see https://amp.dev/documentation/components/amp-list) [DISALLOWED_HTML]
| <script async custom-element="amp-selector" src="https://cdn.ampproject.org/v0/amp-selector-latest.js"></script>
>> ^~~~~~~~~
amp4email_feature_tests/no_latest_extensions.html:33:2 The attribute 'src' in tag 'SCRIPT[custom-element=amp-selector] (AMP4EMAIL)' is set to the invalid value 'https://cdn.ampproject.org/v0/amp-selector-latest.js'. (see https://amp.dev/documentation/components/amp-selector) [DISALLOWED_HTML]
| <script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-latest.js"></script>
>> ^~~~~~~~~
amp4email_feature_tests/no_latest_extensions.html:34:2 The attribute 'src' in tag 'SCRIPT[custom-element=amp-sidebar] (AMP4EMAIL)' is set to the invalid value 'https://cdn.ampproject.org/v0/amp-sidebar-latest.js'. (see https://amp.dev/documentation/components/amp-sidebar) [DISALLOWED_HTML]
| <script async custom-element="amp-timeago" src="https://cdn.ampproject.org/v0/amp-timeago-latest.js"></script>
>> ^~~~~~~~~
amp4email_feature_tests/no_latest_extensions.html:35:2 The attribute 'src' in tag 'amp-timeago extension .js script' is set to the invalid value 'https://cdn.ampproject.org/v0/amp-timeago-latest.js'. (see https://amp.dev/documentation/components/amp-timeago) [CUSTOM_JAVASCRIPT_DISALLOWED]
| <script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-latest.js"></script>
>> ^~~~~~~~~
amp4email_feature_tests/no_latest_extensions.html:36:2 The attribute 'src' in tag 'SCRIPT[custom-template=amp-mustache] (AMP4EMAIL)' is set to the invalid value 'https://cdn.ampproject.org/v0/amp-mustache-latest.js'. (see https://amp.dev/documentation/components/amp-mustache) [DISALLOWED_HTML]
| </head>
| <body>
| Hello, world.
| </body>
| </html>
>> ^~~~~~~~~
amp4email_feature_tests/no_latest_extensions.html:41:6 The extension 'amp-anim' was found on this page, but is unused. Please remove this extension. [AMP_TAG_PROBLEM]
>> ^~~~~~~~~
amp4email_feature_tests/no_latest_extensions.html:41:6 The extension 'amp-carousel' was found on this page, but is unused. Please remove this extension. [AMP_TAG_PROBLEM]
>> ^~~~~~~~~
amp4email_feature_tests/no_latest_extensions.html:41:6 The extension 'amp-list' was found on this page, but is unused. Please remove this extension. [AMP_TAG_PROBLEM]
>> ^~~~~~~~~
amp4email_feature_tests/no_latest_extensions.html:41:6 The extension 'amp-mustache' was found on this page, but is unused. Please remove this extension. [AMP_TAG_PROBLEM]
>> ^~~~~~~~~
amp4email_feature_tests/no_latest_extensions.html:41:6 The extension 'amp-sidebar' was found on this page, but is unused. Please remove this extension. [AMP_TAG_PROBLEM]
>> ^~~~~~~~~
amp4email_feature_tests/no_latest_extensions.html:41:6 The extension 'amp-timeago' was found on this page, but is unused. Please remove this extension. [AMP_TAG_PROBLEM]