|
| 1 | +#standardSQL |
| 2 | +# Section: Content Inclusion - Iframe Sandbox/Permissions Policy |
| 3 | +# Question: How often are the allow and sandbox attributes used on iframes? Both per page (used in at least one iframe on a page) and over all iframe elements |
| 4 | +WITH total_iframe_count AS ( |
| 5 | + SELECT |
| 6 | + client, |
| 7 | + date, |
| 8 | + SUM(SAFE.INT64(custom_metrics.other.num_iframes)) AS total_iframes |
| 9 | + FROM |
| 10 | + `httparchive.crawl.pages` |
| 11 | + WHERE |
| 12 | + (date = '2020-08-01' OR date = '2021-07-01' OR date = '2022-06-01') AND |
| 13 | + is_root_page |
| 14 | + GROUP BY client, date |
| 15 | +) |
| 16 | + |
| 17 | +SELECT |
| 18 | + client, |
| 19 | + date, |
| 20 | + total_iframes, |
| 21 | + COUNTIF(allow IS NOT NULL) AS freq_allow, |
| 22 | + COUNTIF(allow IS NOT NULL) / total_iframes AS pct_allow_frames, |
| 23 | + COUNTIF(sandbox IS NOT NULL) AS freq_sandbox, |
| 24 | + COUNTIF(sandbox IS NOT NULL) / total_iframes AS pct_sandbox_frames, |
| 25 | + COUNTIF(allow IS NOT NULL AND sandbox IS NOT NULL) AS freq_both_frames, |
| 26 | + COUNTIF(allow IS NOT NULL AND sandbox IS NOT NULL) / total_iframes AS pct_both_frames, |
| 27 | + COUNT(DISTINCT url) AS total_urls, |
| 28 | + COUNT(DISTINCT IF(allow IS NOT NULL, url, NULL)) AS allow_freq_urls, |
| 29 | + COUNT(DISTINCT IF(allow IS NOT NULL, url, NULL)) / COUNT(DISTINCT url) AS allow_pct_urls, |
| 30 | + COUNT(DISTINCT IF(sandbox IS NOT NULL, url, NULL)) AS sandbox_freq_urls, |
| 31 | + COUNT(DISTINCT IF(sandbox IS NOT NULL, url, NULL)) / COUNT(DISTINCT url) AS sandbox_pct_urls |
| 32 | +FROM ( |
| 33 | + SELECT |
| 34 | + client, |
| 35 | + date, |
| 36 | + url, |
| 37 | + SAFE.STRING(iframeAttr.allow) AS allow, |
| 38 | + SAFE.STRING(iframeAttr.sandbox) AS sandbox |
| 39 | + FROM ( |
| 40 | + SELECT |
| 41 | + client, |
| 42 | + date, |
| 43 | + page AS url, |
| 44 | + JSON_EXTRACT_ARRAY(custom_metrics.security.`iframe-allow-sandbox`) AS iframeAttrs |
| 45 | + FROM |
| 46 | + `httparchive.crawl.pages` |
| 47 | + WHERE |
| 48 | + (date = '2020-08-01' OR date = '2021-07-01' OR date = '2022-06-01') AND |
| 49 | + is_root_page |
| 50 | + ) LEFT JOIN UNNEST(iframeAttrs) AS iframeAttr |
| 51 | + ) JOIN total_iframe_count USING (client, date) |
| 52 | +GROUP BY |
| 53 | + total_iframes, |
| 54 | + client, |
| 55 | + date |
| 56 | +ORDER BY |
| 57 | + date, |
| 58 | + client |
0 commit comments