|
| 1 | +publish('public_hash_list', { |
| 2 | + type: 'table', |
| 3 | + schema: 'performance', |
| 4 | + description: `Identifies web resources (scripts, CSS, fonts, WASM) whose SHA-256 body hash appears across >=100 independent origins in the HTTP Archive monthly crawl. |
| 5 | +The >=100-origins threshold is the k-anonymity privacy gate: a resource that widespread cannot serve as a cross-site identifier. |
| 6 | +Traffic-weighted score: each hash is scored by SUM(100000 / min_rank) across origins, where min_rank is the CrUX popularity bucket of the hosting page (1 000 = top 1K sites -> 100 pts; 1 000 000 = top 1M -> 0.1 pt). This lifts hashes carried by high-traffic pages to the top of the list. |
| 7 | +Results are published as a world-readable Google Sheet: https://docs.google.com/spreadsheets/d/1Cw4wguQ0X4xMqZlTRYlo6OHQaUr7UVYlFZaIQkXK2Jw/edit?usp=sharing |
| 8 | +The CSV export used by http-archive.js: https://docs.google.com/spreadsheets/d/e/2PACX-1vTOcTespiVHDRLIq16_3GsnnvJmut00x0fzWTLXSWBNya6Go_1kBrGoVJvxb8gEaP_L9FfKmXy3-kF-/pub?output=csv |
| 9 | +Repo: https://github.com/tomayac/public-hash-list`, |
| 10 | + columns: { |
| 11 | + body_hash: 'SHA-256 body hash of the resource from WebPageTest payload', |
| 12 | + type: 'Simplified type of the resource (script, css, font, wasm)', |
| 13 | + num_origins: |
| 14 | + 'Number of independent origins hosting the resource (privacy-gated threshold of >= 100)', |
| 15 | + traffic_weighted_score: |
| 16 | + 'Traffic-weighted popularity score (SUM(100000 / min_rank) across origins, where min_rank is the CrUX rank bucket of the hosting page)', |
| 17 | + sample_url: 'A sample URL where this resource was detected' |
| 18 | + }, |
| 19 | + tags: ['crawl_complete'] |
| 20 | +}) |
| 21 | + .query( |
| 22 | + (ctx) => ` |
| 23 | +WITH request_origins AS ( |
| 24 | + SELECT |
| 25 | + SAFE.STRING(payload._body_hash) AS body_hash, |
| 26 | + type, |
| 27 | + NET.HOST(url) AS origin, |
| 28 | + MIN(rank) AS min_rank, |
| 29 | + ANY_VALUE(url) AS sample_url |
| 30 | + FROM ${ctx.ref('crawl', 'requests')} |
| 31 | + WHERE |
| 32 | + date = DATE_TRUNC(CURRENT_DATE(), MONTH) |
| 33 | + AND SAFE.STRING(payload._body_hash) IS NOT NULL |
| 34 | + AND type IN ('script', 'css', 'font', 'wasm') |
| 35 | + AND SAFE.STRING(summary.method) = 'GET' |
| 36 | + GROUP BY |
| 37 | + body_hash, |
| 38 | + type, |
| 39 | + origin |
| 40 | +), |
| 41 | +
|
| 42 | +hash_popularity AS ( |
| 43 | + SELECT |
| 44 | + body_hash, |
| 45 | + type, |
| 46 | + COUNT(DISTINCT origin) AS num_origins, |
| 47 | + SUM(100000.0 / min_rank) AS traffic_weighted_score, |
| 48 | + ANY_VALUE(sample_url) AS sample_url |
| 49 | + FROM request_origins |
| 50 | + GROUP BY |
| 51 | + body_hash, |
| 52 | + type |
| 53 | +) |
| 54 | +
|
| 55 | +SELECT |
| 56 | + body_hash, |
| 57 | + type, |
| 58 | + num_origins, |
| 59 | + traffic_weighted_score, |
| 60 | + sample_url |
| 61 | +FROM hash_popularity |
| 62 | +WHERE |
| 63 | + num_origins >= 100 |
| 64 | +ORDER BY |
| 65 | + traffic_weighted_score DESC |
| 66 | +` |
| 67 | + ) |
| 68 | + .postOps( |
| 69 | + (ctx) => ` |
| 70 | +SELECT |
| 71 | + reports.run_export_job( |
| 72 | + JSON '''{ |
| 73 | + "destination": "cloud_storage", |
| 74 | + "config": { |
| 75 | + "bucket": "${constants.bucket}", |
| 76 | + "name": "${constants.storagePath}public_hash_list.csv", |
| 77 | + "format": "csv" |
| 78 | + }, |
| 79 | + "query": "SELECT * FROM ${ctx.self()}" |
| 80 | + }''' |
| 81 | + ); |
| 82 | +` |
| 83 | + ) |
0 commit comments