Skip to content

Commit

Permalink
Keep nonces (#883)
Browse files Browse the repository at this point in the history
Disable RemoveNonce transformer as they're now supported by the AMP
Validator. See ampproject/amphtml#26418
  • Loading branch information
sebastianbenz authored and tharders committed Aug 17, 2020
1 parent da31412 commit 3cd2396
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 0 additions & 2 deletions packages/optimizer/lib/DomTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ const TRANSFORMATIONS_AMP_FIRST = [
// Move keyframes into a separate style tag
'SeparateKeyframes',
'AddTransformedFlag',
// Removes unsupported nonce attribute from scripts
'RemoveCspNonce',
// Minifies HTML, JSON, inline amp-script
'MinifyHtml',
// Inject CSP script has required for inline amp-script
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-experiment" src="https://cdn.ampproject.org/v0/amp-experiment-0.1.js"></script>
<script async src="https://cdn.ampproject.org/v0/amp-video-0.1.js" custom-element="amp-video"></script>
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.1.js"></script>
<script async custom-template="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<link rel="preload" href="https://amp.dev/static/samples/img/amp.jpg" as="image" data-hero>
<link rel="canonical" href="self.html"><style amp-custom>h1{margin:16px}</style>
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script async src="https://cdn.ampproject.org/lts/v0.js"></script>
<script async custom-element="amp-experiment" src="https://cdn.ampproject.org/lts/v0/amp-experiment-0.1.js"></script>
<script async src="https://cdn.ampproject.org/lts/v0/amp-video-0.1.js" custom-element="amp-video"></script>
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/lts/v0/amp-mustache-0.1.js"></script>
<script async custom-template="amp-analytics" src="https://cdn.ampproject.org/lts/v0/amp-analytics-0.1.js"></script>
<link rel="preload" href="https://amp.dev/static/samples/img/amp.jpg" as="image" data-hero>
<link rel="canonical" href="self.html"><style amp-custom>h1{margin:16px}</style>
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<script async src="https://example.com/amp/rtv/123456789000000/v0.js"></script>
<script async custom-element="amp-experiment" src="https://example.com/amp/rtv/123456789000000/v0/amp-experiment-0.1.js"></script>
<script async src="https://example.com/amp/rtv/123456789000000/v0/amp-video-0.1.js" custom-element="amp-video"></script>
<script async custom-template="amp-mustache" src="https://example.com/amp/rtv/123456789000000/v0/amp-mustache-0.1.js"></script>
<script async custom-template="amp-analytics" src="https://example.com/amp/rtv/123456789000000/v0/amp-analytics-0.1.js"></script>
<link rel="preload" href="https://amp.dev/static/samples/img/amp.jpg" as="image" data-hero>
<link rel="canonical" href="self.html"><style amp-custom>h1{margin:16px}</style>
<link rel="amphtml" href="/amp-version.html">
Expand Down
3 changes: 2 additions & 1 deletion packages/optimizer/spec/end-to-end/hello-world/input.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
<meta name="viewport" content="width=device-width,minimum-scale=1">
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async nonce="484fee01e48047fa23773ddcbc3feb0a" custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<script async custom-element="amp-experiment" src="https://cdn.ampproject.org/v0/amp-experiment-0.1.js"></script>
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.1.js"></script>
<script async custom-template="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<style amp-custom>h1 { margin: 16px; }</style>
</head>
<body>
Expand Down
1 change: 1 addition & 0 deletions packages/optimizer/spec/valid-amp/files/_Hello_World.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<title> Hello World</title>

<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async nonce="484fee01e48047fa23773ddcbc3feb0a" custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>

<link rel="canonical" href="https://example.com/introduction/hello_world/">

Expand Down

0 comments on commit 3cd2396

Please sign in to comment.