clearcote 0.56.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +8 -9
- package/dist/agent.js.map +1 -1
- package/dist/cloud.js +1 -1
- package/dist/cloud.js.map +1 -1
- package/dist/crlset.d.ts +125 -0
- package/dist/crlset.d.ts.map +1 -0
- package/dist/crlset.js +545 -0
- package/dist/crlset.js.map +1 -0
- package/dist/index.d.ts +23 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -14
- package/dist/index.js.map +1 -1
- package/dist/license.d.ts +8 -0
- package/dist/license.d.ts.map +1 -1
- package/dist/license.js +40 -13
- package/dist/license.js.map +1 -1
- package/dist/multiplex.d.ts.map +1 -1
- package/dist/multiplex.js +18 -3
- package/dist/multiplex.js.map +1 -1
- package/dist/profileauto.d.ts.map +1 -1
- package/dist/profileauto.js +12 -2
- package/dist/profileauto.js.map +1 -1
- package/dist/profilesource.d.ts +7 -0
- package/dist/profilesource.d.ts.map +1 -1
- package/dist/profilesource.js +32 -6
- package/dist/profilesource.js.map +1 -1
- package/dist/widevine.d.ts +11 -0
- package/dist/widevine.d.ts.map +1 -1
- package/dist/widevine.js +18 -11
- package/dist/widevine.js.map +1 -1
- package/package.json +1 -1
package/dist/crlset.js
ADDED
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
// Chrome's revocation list (CRLSet) for an engine that never receives one.
|
|
2
|
+
//
|
|
3
|
+
// Real Chrome downloads a CRLSet through its component updater: Google's list of revoked and blocked
|
|
4
|
+
// certificate keys, which is how a CA distrust reaches the browser within hours (the eMudhra key compromise of
|
|
5
|
+
// 2026-10-17 shipped as CRLSet 10849). A Clearcote engine never gets it: the updater URL is
|
|
6
|
+
// domain-substituted to a dead host, and Playwright launches with --disable-component-update anyway. So every
|
|
7
|
+
// engine since 149 kept trusting those intermediates (tested on 12 builds, 149-155, free and PRO).
|
|
8
|
+
//
|
|
9
|
+
// The engine still knows how to use one. This module:
|
|
10
|
+
//
|
|
11
|
+
// 1. SEEDS a CRLSet into the profile (`<userDataDir>/CertificateRevocation/<sequence>/crl-set` plus a
|
|
12
|
+
// manifest). Chrome checks only that the file exists (CRLSetPolicy::VerifyInstallation), so a cached copy
|
|
13
|
+
// loads as is. An expired one still blocks everything it lists: expiry only turns off the "known good"
|
|
14
|
+
// shortcut (revocation_checker.cc).
|
|
15
|
+
// 2. UN-SUPPRESSES the component updater. Without it RegisterComponentsForUpdate never runs and the seeded
|
|
16
|
+
// file is never read. The updater makes no network request on this engine (NetLog, 90 s idle with
|
|
17
|
+
// fast-update: no update check, no DNS, nothing through the proxy).
|
|
18
|
+
// 3. WAITS until the CRLSet is live before the caller gets the browser. Chrome loads it with BEST_EFFORT tasks
|
|
19
|
+
// that only run once startup completes, and startup completes when the first tab has been idle for a
|
|
20
|
+
// moment (AfterStartupTaskUtils, 3 min failsafe). A caller who navigates straight away would keep the tab
|
|
21
|
+
// busy and stay unprotected for minutes. So the first tab stays on about:blank until the CRLSet applies.
|
|
22
|
+
//
|
|
23
|
+
// Readiness signal: applying a CRLSet changes the cert verifier, and the network service then closes its
|
|
24
|
+
// idle pooled connections, plain HTTP ones included. The probe keeps one keep-alive HTTP connection to a
|
|
25
|
+
// local server on 127.0.0.1 and waits for that connection to be dropped and re-opened (no certificate) AFTER
|
|
26
|
+
// startup has completed (the `Startup.AfterStartupTaskCount` histogram, read over CDP): a network change at
|
|
27
|
+
// launch drops it too (seen on Linux) and must not count. Measured live on Windows and Linux: an eMudhra
|
|
28
|
+
// host navigated right after is ERR_CERT_REVOKED. It adds a few seconds to a launch.
|
|
29
|
+
//
|
|
30
|
+
// OPT-IN: `crlset: true` (or CLEARCOTE_CRLSET=1). Where the CRLSet comes from, first match wins:
|
|
31
|
+
// `crlset: "<path>"` (a crl-set file or a component directory), CLEARCOTE_CRLSET_FILE, then the newest
|
|
32
|
+
// copy in the cache (CLEARCOTE_CRLSET_DIR, else ~/.clearcote/crlset). An empty cache is filled at launch
|
|
33
|
+
// from Google's component updater, the same Omaha service the Widevine fetch uses (sha256 from the HTTPS
|
|
34
|
+
// update response); a cache older than 6 h is refreshed in the background while the launch uses it.
|
|
35
|
+
// CLEARCOTE_CRLSET_URL points the fetch at a mirror instead. The cache layout (`<sequence>/crl-set`) is
|
|
36
|
+
// shared by the Python, Node and .NET SDKs. Same rules, names and warnings as the Python SDK (_crlset.py).
|
|
37
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
38
|
+
import { mkdirSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
39
|
+
import { createServer } from "node:http";
|
|
40
|
+
import os from "node:os";
|
|
41
|
+
import path from "node:path";
|
|
42
|
+
import { performance } from "node:perf_hooks";
|
|
43
|
+
import extract from "extract-zip";
|
|
44
|
+
import { OMAHA_URL, crx3ToZip, omahaRequestBody, omahaUserAgent, parseUpdate, postJson, unsuppressComponentUpdate, withTimeout } from "./widevine.js";
|
|
45
|
+
export const COMPONENT_DIR = "CertificateRevocation";
|
|
46
|
+
export const CRLSET_FILE = "crl-set";
|
|
47
|
+
export const CRLSET_APP_ID = "hfnkpimlhhgieaddgfemjhofmfblmnib"; // Chrome's CRLSet component
|
|
48
|
+
export const DEFAULT_TIMEOUT_SECONDS = 15; // the readiness wait (CLEARCOTE_CRLSET_TIMEOUT, crlsetTimeout)
|
|
49
|
+
export const FETCH_TIMEOUT_SECONDS = 15; // how long a launch waits for a first download (CLEARCOTE_CRLSET_FETCH_TIMEOUT)
|
|
50
|
+
export const REFRESH_SECONDS = 6 * 3600; // a cache older than this is refreshed in the background
|
|
51
|
+
export const STAMP_FILE = ".last-check"; // in the cache root: mtime = the last fetch attempt
|
|
52
|
+
const WARNED = new Set();
|
|
53
|
+
let refreshJob;
|
|
54
|
+
function warnOnce(key, message, quiet) {
|
|
55
|
+
if (quiet || process.env.CLEARCOTE_NO_WARN || WARNED.has(key))
|
|
56
|
+
return;
|
|
57
|
+
WARNED.add(key);
|
|
58
|
+
process.stderr.write(`clearcote: crlset: ${message}\n`);
|
|
59
|
+
}
|
|
60
|
+
/** Tests: forget the warnings already said (each warns once per process). */
|
|
61
|
+
export function resetCrlsetWarnings() {
|
|
62
|
+
WARNED.clear();
|
|
63
|
+
}
|
|
64
|
+
/** Tests: the background refresh in flight, if any. */
|
|
65
|
+
export function crlsetRefreshInFlight() {
|
|
66
|
+
return refreshJob;
|
|
67
|
+
}
|
|
68
|
+
function errName(e) {
|
|
69
|
+
return e?.name ?? "Error";
|
|
70
|
+
}
|
|
71
|
+
function errText(e) {
|
|
72
|
+
return String(e?.message ?? e);
|
|
73
|
+
}
|
|
74
|
+
export function cacheRoot() {
|
|
75
|
+
return process.env.CLEARCOTE_CRLSET_DIR ?? path.join(os.homedir(), ".clearcote", "crlset");
|
|
76
|
+
}
|
|
77
|
+
/** The JSON header of a CRLSet file (little-endian uint16 length, then JSON). Throws on anything else. */
|
|
78
|
+
export function parseHeader(data) {
|
|
79
|
+
if (data.length < 2)
|
|
80
|
+
throw new Error("not a CRLSet: too short");
|
|
81
|
+
const length = data.readUInt16LE(0);
|
|
82
|
+
let header;
|
|
83
|
+
try {
|
|
84
|
+
header = JSON.parse(data.subarray(2, 2 + length).toString("utf8"));
|
|
85
|
+
}
|
|
86
|
+
catch (e) {
|
|
87
|
+
throw new Error(`not a CRLSet: bad header (${errText(e)})`);
|
|
88
|
+
}
|
|
89
|
+
if (!header || typeof header !== "object" || Array.isArray(header) || header.ContentType !== "CRLSet") {
|
|
90
|
+
throw new Error("not a CRLSet: ContentType is not CRLSet");
|
|
91
|
+
}
|
|
92
|
+
if (!Number.isInteger(header.Sequence))
|
|
93
|
+
throw new Error("not a CRLSet: no Sequence");
|
|
94
|
+
return header;
|
|
95
|
+
}
|
|
96
|
+
function isFile(p) {
|
|
97
|
+
try {
|
|
98
|
+
return statSync(p).isFile();
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function isDir(p) {
|
|
105
|
+
try {
|
|
106
|
+
return statSync(p).isDirectory();
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/** A crl-set file path from a file or a component directory (`<dir>/crl-set` or `<dir>/<ver>/crl-set`). */
|
|
113
|
+
function asCrlsetFile(p) {
|
|
114
|
+
if (isFile(p))
|
|
115
|
+
return p;
|
|
116
|
+
const direct = path.join(p, CRLSET_FILE);
|
|
117
|
+
if (isFile(direct))
|
|
118
|
+
return direct;
|
|
119
|
+
const versions = [];
|
|
120
|
+
for (const name of isDir(p) ? readdirSync(p) : []) {
|
|
121
|
+
const candidate = path.join(p, name, CRLSET_FILE);
|
|
122
|
+
if (!isFile(candidate))
|
|
123
|
+
continue;
|
|
124
|
+
try {
|
|
125
|
+
versions.push([parseHeader(readFileSync(candidate)).Sequence, candidate]);
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (!versions.length)
|
|
132
|
+
throw new Error(`no crl-set file under ${p}`);
|
|
133
|
+
versions.sort((a, b) => a[0] - b[0] || (a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : 0));
|
|
134
|
+
return versions[versions.length - 1][1];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Copy a CRLSet (a crl-set file, or Chrome's `CertificateRevocation` directory) into the cache as
|
|
138
|
+
* `<cache>/<sequence>/crl-set`. Returns that path.
|
|
139
|
+
*/
|
|
140
|
+
export function installCrlset(source) {
|
|
141
|
+
const src = asCrlsetFile(source);
|
|
142
|
+
const data = readFileSync(src);
|
|
143
|
+
const sequence = parseHeader(data).Sequence;
|
|
144
|
+
const destDir = path.join(cacheRoot(), String(sequence));
|
|
145
|
+
mkdirSync(destDir, { recursive: true });
|
|
146
|
+
const dest = path.join(destDir, CRLSET_FILE);
|
|
147
|
+
const tmp = dest + ".tmp";
|
|
148
|
+
writeFileSync(tmp, data);
|
|
149
|
+
renameSync(tmp, dest);
|
|
150
|
+
return dest;
|
|
151
|
+
}
|
|
152
|
+
/** The current CRLSet from Google's component updater (the crl-set bytes). Verified against the sha256
|
|
153
|
+
* of the HTTPS update response (the package itself may come over plain HTTP from edgedl). `work` is a
|
|
154
|
+
* scratch directory for the zip. */
|
|
155
|
+
async function downloadFromGoogle(work, signal) {
|
|
156
|
+
const body = omahaRequestBody(); // the Omaha client the Widevine fetch uses
|
|
157
|
+
body.request.app[0].appid = CRLSET_APP_ID;
|
|
158
|
+
const [url, sha256] = parseUpdate(await postJson(OMAHA_URL, body, signal));
|
|
159
|
+
const res = await fetch(url, { headers: { "User-Agent": omahaUserAgent() }, redirect: "follow", signal });
|
|
160
|
+
if (!res.ok)
|
|
161
|
+
throw new Error(`CRLSet download HTTP ${res.status}`);
|
|
162
|
+
const blob = Buffer.from(await res.arrayBuffer());
|
|
163
|
+
if (!sha256 || createHash("sha256").update(blob).digest("hex") !== sha256.toLowerCase()) {
|
|
164
|
+
throw new Error("CRLSet sha256 mismatch - refusing to install");
|
|
165
|
+
}
|
|
166
|
+
const zipPath = path.join(work, "crlset.zip");
|
|
167
|
+
writeFileSync(zipPath, crx3ToZip(blob));
|
|
168
|
+
const unpacked = path.join(work, "unpacked");
|
|
169
|
+
await extract(zipPath, { dir: unpacked });
|
|
170
|
+
return readFileSync(path.join(unpacked, CRLSET_FILE));
|
|
171
|
+
}
|
|
172
|
+
function touchStamp() {
|
|
173
|
+
const root = cacheRoot();
|
|
174
|
+
mkdirSync(root, { recursive: true });
|
|
175
|
+
writeFileSync(path.join(root, STAMP_FILE), "");
|
|
176
|
+
}
|
|
177
|
+
function stampFresh() {
|
|
178
|
+
try {
|
|
179
|
+
return Date.now() - statSync(path.join(cacheRoot(), STAMP_FILE)).mtimeMs < REFRESH_SECONDS * 1000;
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Download the current CRLSet into the cache and return its path: from Google's component updater, or
|
|
187
|
+
* from `url` / CLEARCOTE_CRLSET_URL (a mirror serving the raw crl-set file).
|
|
188
|
+
*/
|
|
189
|
+
export async function fetchCrlset(url, signal) {
|
|
190
|
+
url = url || process.env.CLEARCOTE_CRLSET_URL;
|
|
191
|
+
const limit = withTimeout(60_000, signal);
|
|
192
|
+
touchStamp(); // a failed attempt counts too: no retry storm against Google
|
|
193
|
+
const tmpDir = path.join(cacheRoot(), `.download-${process.pid}-${randomBytes(6).toString("hex")}`);
|
|
194
|
+
mkdirSync(tmpDir, { recursive: true });
|
|
195
|
+
try {
|
|
196
|
+
let data;
|
|
197
|
+
if (url) {
|
|
198
|
+
const res = await fetch(url, { redirect: "follow", signal: limit });
|
|
199
|
+
if (!res.ok)
|
|
200
|
+
throw new Error(`CRLSet download HTTP ${res.status}`);
|
|
201
|
+
data = Buffer.from(await res.arrayBuffer());
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
data = await downloadFromGoogle(tmpDir, limit);
|
|
205
|
+
}
|
|
206
|
+
parseHeader(data);
|
|
207
|
+
const tmp = path.join(tmpDir, CRLSET_FILE);
|
|
208
|
+
writeFileSync(tmp, data);
|
|
209
|
+
return installCrlset(tmp);
|
|
210
|
+
}
|
|
211
|
+
finally {
|
|
212
|
+
rmSync(tmpDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/** At most one refresh per process at a time; the launch goes on with the cached copy. */
|
|
216
|
+
function refreshInBackground() {
|
|
217
|
+
if (refreshJob)
|
|
218
|
+
return;
|
|
219
|
+
const job = fetchCrlset()
|
|
220
|
+
.then(() => undefined, () => undefined) // the cached copy still serves; the next stale launch retries
|
|
221
|
+
.finally(() => { if (refreshJob === job)
|
|
222
|
+
refreshJob = undefined; });
|
|
223
|
+
refreshJob = job;
|
|
224
|
+
}
|
|
225
|
+
function secondsFromEnv(name, fallback) {
|
|
226
|
+
const raw = process.env[name];
|
|
227
|
+
if (!raw)
|
|
228
|
+
return fallback;
|
|
229
|
+
const value = Number(raw);
|
|
230
|
+
if (!Number.isFinite(value))
|
|
231
|
+
throw new Error(`could not convert ${name}=${JSON.stringify(raw)} to seconds`);
|
|
232
|
+
return value;
|
|
233
|
+
}
|
|
234
|
+
/** An empty cache: fetch now, waiting at most CLEARCOTE_CRLSET_FETCH_TIMEOUT. The path, or undefined (warned). */
|
|
235
|
+
async function fetchFirst(quiet) {
|
|
236
|
+
const wait = secondsFromEnv("CLEARCOTE_CRLSET_FETCH_TIMEOUT", FETCH_TIMEOUT_SECONDS);
|
|
237
|
+
// Aborted at the deadline (Python lets its daemon thread finish): a pending fetch would keep the Node
|
|
238
|
+
// process alive after the caller's script ends. The next launch, still with an empty cache, retries.
|
|
239
|
+
const abort = new AbortController();
|
|
240
|
+
const job = fetchCrlset(undefined, abort.signal).then((ok) => ({ ok }), (err) => ({ err }));
|
|
241
|
+
let timer;
|
|
242
|
+
const deadline = new Promise((resolve) => { timer = setTimeout(() => resolve("timeout"), wait * 1000); });
|
|
243
|
+
try {
|
|
244
|
+
const r = await Promise.race([job, deadline]);
|
|
245
|
+
if (r === "timeout") {
|
|
246
|
+
abort.abort();
|
|
247
|
+
warnOnce("fetch", `no CRLSet cached and the first download took over ${wait} s; launching without ` +
|
|
248
|
+
"one (the next launch tries again)", quiet);
|
|
249
|
+
return undefined;
|
|
250
|
+
}
|
|
251
|
+
if ("err" in r) {
|
|
252
|
+
warnOnce("fetch", `could not fetch a CRLSet (${errName(r.err)}: ${errText(r.err).slice(0, 160)}); launching without one`, quiet);
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
255
|
+
return r.ok;
|
|
256
|
+
}
|
|
257
|
+
finally {
|
|
258
|
+
clearTimeout(timer);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
/** The crl-set file to seed, or undefined. `explicit` (a path) > CLEARCOTE_CRLSET_FILE > newest cached. */
|
|
262
|
+
export function findCrlset(explicit) {
|
|
263
|
+
for (const p of [explicit, process.env.CLEARCOTE_CRLSET_FILE]) {
|
|
264
|
+
if (p)
|
|
265
|
+
return asCrlsetFile(p);
|
|
266
|
+
}
|
|
267
|
+
const root = cacheRoot();
|
|
268
|
+
if (!isDir(root))
|
|
269
|
+
return undefined;
|
|
270
|
+
try {
|
|
271
|
+
return asCrlsetFile(root);
|
|
272
|
+
}
|
|
273
|
+
catch {
|
|
274
|
+
return undefined;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/** {@link findCrlset}, filling an empty cache from Google first and refreshing a stale one in the
|
|
278
|
+
* background. undefined when there is none to be had (warned once). */
|
|
279
|
+
export async function resolveCrlset(explicit, quiet) {
|
|
280
|
+
const found = findCrlset(explicit);
|
|
281
|
+
if (explicit || process.env.CLEARCOTE_CRLSET_FILE)
|
|
282
|
+
return found;
|
|
283
|
+
if (found === undefined)
|
|
284
|
+
return fetchFirst(quiet);
|
|
285
|
+
if (!stampFresh())
|
|
286
|
+
refreshInBackground();
|
|
287
|
+
return found;
|
|
288
|
+
}
|
|
289
|
+
/** `crlset` (undefined/null reads CLEARCOTE_CRLSET) -> [mode, path]: mode is "off" (the default), "wait" or "nowait". */
|
|
290
|
+
export function crlsetMode(value) {
|
|
291
|
+
if (value === undefined || value === null) {
|
|
292
|
+
const env = String(process.env.CLEARCOTE_CRLSET ?? "").trim().toLowerCase();
|
|
293
|
+
if (env === "nowait")
|
|
294
|
+
return ["nowait", undefined];
|
|
295
|
+
return [["1", "true", "on", "yes"].includes(env) ? "wait" : "off", undefined];
|
|
296
|
+
}
|
|
297
|
+
if (value === false)
|
|
298
|
+
return ["off", undefined];
|
|
299
|
+
if (value === true)
|
|
300
|
+
return ["wait", undefined];
|
|
301
|
+
if (value === "nowait")
|
|
302
|
+
return ["nowait", undefined];
|
|
303
|
+
if (typeof value === "string")
|
|
304
|
+
return ["wait", value];
|
|
305
|
+
throw new Error(`crlset must be true, false, "nowait" or a path to a CRLSet, not ${JSON.stringify(value)}`);
|
|
306
|
+
}
|
|
307
|
+
/** Place the CRLSet in the profile where the component installer finds it. Keeps a newer one that is
|
|
308
|
+
* already there (a reused profile). Returns the sequence now in the profile. */
|
|
309
|
+
export function seedCrlset(userDataDir, crlsetFile) {
|
|
310
|
+
const data = readFileSync(crlsetFile);
|
|
311
|
+
const sequence = parseHeader(data).Sequence;
|
|
312
|
+
const base = path.join(userDataDir, COMPONENT_DIR);
|
|
313
|
+
const present = [];
|
|
314
|
+
if (isDir(base)) {
|
|
315
|
+
for (const name of readdirSync(base)) {
|
|
316
|
+
if (/^\d+$/.test(name) && isFile(path.join(base, name, CRLSET_FILE)))
|
|
317
|
+
present.push(Number(name));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
if (present.length && Math.max(...present) >= sequence)
|
|
321
|
+
return Math.max(...present);
|
|
322
|
+
const versionDir = path.join(base, String(sequence));
|
|
323
|
+
mkdirSync(versionDir, { recursive: true });
|
|
324
|
+
writeFileSync(path.join(versionDir, CRLSET_FILE), data);
|
|
325
|
+
writeFileSync(path.join(versionDir, "manifest.json"), JSON.stringify({ manifest_version: 2, name: "crl-set-clearcote.data", version: String(sequence) }));
|
|
326
|
+
return sequence;
|
|
327
|
+
}
|
|
328
|
+
/** Drop Playwright's --disable-component-update (as the Widevine seeding does). `true` already ignores every
|
|
329
|
+
* default argument; list/unset forms get the flag added. Mutates `options.ignoreDefaultArgs`. */
|
|
330
|
+
export function unsuppressComponentUpdater(options) {
|
|
331
|
+
options.ignoreDefaultArgs = unsuppressComponentUpdate(options.ignoreDefaultArgs);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Remove `crlset` / `crlsetTimeout` from `options`, seed the profile and un-suppress the updater.
|
|
335
|
+
* Resolves to a {@link CrlsetReadiness} when the launch must wait, else undefined.
|
|
336
|
+
* Never rejects: revocation data is best-effort and must not stop a launch.
|
|
337
|
+
*/
|
|
338
|
+
export async function applyCrlsetLaunch(userDataDir, options, quiet) {
|
|
339
|
+
const value = options.crlset;
|
|
340
|
+
let timeout = options.crlsetTimeout;
|
|
341
|
+
delete options.crlset;
|
|
342
|
+
delete options.crlsetTimeout;
|
|
343
|
+
try {
|
|
344
|
+
const [mode, explicit] = crlsetMode(value);
|
|
345
|
+
if (mode === "off")
|
|
346
|
+
return undefined;
|
|
347
|
+
let crlsetFile;
|
|
348
|
+
try {
|
|
349
|
+
crlsetFile = await resolveCrlset(explicit, quiet);
|
|
350
|
+
}
|
|
351
|
+
catch (e) {
|
|
352
|
+
warnOnce("find", `no usable CRLSet (${errText(e)}); launching without one`, quiet);
|
|
353
|
+
return undefined;
|
|
354
|
+
}
|
|
355
|
+
if (crlsetFile === undefined)
|
|
356
|
+
return undefined; // resolveCrlset warned
|
|
357
|
+
const sequence = seedCrlset(userDataDir, crlsetFile);
|
|
358
|
+
unsuppressComponentUpdater(options);
|
|
359
|
+
if (mode === "nowait")
|
|
360
|
+
return undefined;
|
|
361
|
+
if (timeout === undefined || timeout === null)
|
|
362
|
+
timeout = secondsFromEnv("CLEARCOTE_CRLSET_TIMEOUT", DEFAULT_TIMEOUT_SECONDS);
|
|
363
|
+
return new CrlsetReadiness(Number(timeout), sequence, quiet);
|
|
364
|
+
}
|
|
365
|
+
catch (e) {
|
|
366
|
+
warnOnce("seed", `seeding failed (${errName(e)}: ${errText(e)}); launching without one`, quiet);
|
|
367
|
+
return undefined;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
/** HTTP/1.1 on 127.0.0.1 that records when the browser opens each TCP connection to it. */
|
|
371
|
+
export class ProbeServer {
|
|
372
|
+
server;
|
|
373
|
+
opened = []; // performance.now() of each connection
|
|
374
|
+
url = "";
|
|
375
|
+
constructor(server) {
|
|
376
|
+
this.server = server;
|
|
377
|
+
}
|
|
378
|
+
static async start() {
|
|
379
|
+
const server = createServer((_req, res) => {
|
|
380
|
+
res.writeHead(204, { "Access-Control-Allow-Origin": "*", "Content-Length": "0" });
|
|
381
|
+
res.end();
|
|
382
|
+
});
|
|
383
|
+
// keep-alive (HTTP/1.1): the browser pools the connection. No idle timeout: a connection the server closed
|
|
384
|
+
// would be re-opened and read as the CRLSet's drop.
|
|
385
|
+
server.keepAliveTimeout = 0;
|
|
386
|
+
const probe = new ProbeServer(server);
|
|
387
|
+
server.on("connection", () => { probe.opened.push(performance.now()); });
|
|
388
|
+
await new Promise((resolve, reject) => {
|
|
389
|
+
server.once("error", reject);
|
|
390
|
+
server.listen(0, "127.0.0.1", () => { server.off("error", reject); resolve(); });
|
|
391
|
+
});
|
|
392
|
+
server.unref(); // never keeps the process alive
|
|
393
|
+
probe.url = `http://127.0.0.1:${server.address().port}/`;
|
|
394
|
+
return probe;
|
|
395
|
+
}
|
|
396
|
+
count() {
|
|
397
|
+
return this.opened.length;
|
|
398
|
+
}
|
|
399
|
+
/** A connection other than the first was opened after `moment`: the pooled one was dropped. */
|
|
400
|
+
reopenedAfter(moment) {
|
|
401
|
+
return this.opened.slice(1).some((t) => t > moment);
|
|
402
|
+
}
|
|
403
|
+
close() {
|
|
404
|
+
this.server.closeAllConnections();
|
|
405
|
+
this.server.close();
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
// runs in the page (the browser's fetch takes `cache`; Node's RequestInit type does not list it)
|
|
409
|
+
const probeJs = (u) => fetch(u, { cache: "no-store" }).then((r) => r.status, () => 0);
|
|
410
|
+
export const STARTUP_HISTOGRAM = "Startup.AfterStartupTaskCount"; // recorded once, when startup completes
|
|
411
|
+
export const ALREADY_STARTED_GRACE_SECONDS = 1.5; // startup was complete before the wait began: the drop may be past
|
|
412
|
+
/**
|
|
413
|
+
* When the CRLSet is live, from the probe's connections and the startup histogram.
|
|
414
|
+
*
|
|
415
|
+
* Not every dropped connection is the CRLSet: a network change (seen on Linux at launch) drops them too.
|
|
416
|
+
* The CRLSet is read only after startup completes (its loader is a BEST_EFFORT task), so only a drop seen
|
|
417
|
+
* after the histogram appeared counts. If startup was already complete at the first check, the drop may have
|
|
418
|
+
* happened before the probe connected: a short grace, then it counts as live. Without the histogram (CDP
|
|
419
|
+
* refused it) the first drop counts, as before.
|
|
420
|
+
*/
|
|
421
|
+
export class ReadinessState {
|
|
422
|
+
server;
|
|
423
|
+
startedAt; // performance.now() the histogram was first seen
|
|
424
|
+
alreadyStarted = false;
|
|
425
|
+
histogram = true; // false once the browser refused Browser.getHistogram
|
|
426
|
+
constructor(server) {
|
|
427
|
+
this.server = server;
|
|
428
|
+
}
|
|
429
|
+
noteStartup(present, firstCheck, now) {
|
|
430
|
+
if (this.startedAt === undefined && present) {
|
|
431
|
+
this.startedAt = now;
|
|
432
|
+
this.alreadyStarted = firstCheck;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
ready(now) {
|
|
436
|
+
if (!this.histogram)
|
|
437
|
+
return this.server.count() >= 2;
|
|
438
|
+
if (this.startedAt === undefined)
|
|
439
|
+
return false;
|
|
440
|
+
if (this.server.reopenedAfter(this.startedAt))
|
|
441
|
+
return true;
|
|
442
|
+
return this.alreadyStarted && now - this.startedAt >= ALREADY_STARTED_GRACE_SECONDS * 1000;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Launch args that send `rule` around a Playwright-handled proxy, else []. Playwright adds `<-loopback>`
|
|
447
|
+
* after the caller's bypass rules, and Chrome evaluates bypass rules last-first, so a rule added to
|
|
448
|
+
* `proxy.bypass` loses and the local probe went to the user's proxy as `CONNECT 127.0.0.1:<port>` (seen
|
|
449
|
+
* live). Chrome keeps the last of a repeated switch and Playwright puts the caller's args after its own, so
|
|
450
|
+
* this repeats Playwright's list with `rule` LAST: only that host:port goes direct; other loopback traffic
|
|
451
|
+
* still goes through the proxy. A proxy the SDK hands to the engine itself (credentials, see resolveProxy)
|
|
452
|
+
* has no `<-loopback>` and needs nothing.
|
|
453
|
+
*/
|
|
454
|
+
export function proxyBypassArgs(pwOptions, rule) {
|
|
455
|
+
const proxy = pwOptions.proxy;
|
|
456
|
+
if (!proxy)
|
|
457
|
+
return [];
|
|
458
|
+
let rules = String(proxy.bypass ?? "").split(",").map((r) => r.trim()).filter(Boolean);
|
|
459
|
+
rules = rules.map((r) => (r.startsWith(".") ? "*" + r : r)); // as Playwright does
|
|
460
|
+
if (!process.env.PLAYWRIGHT_DISABLE_FORCED_CHROMIUM_PROXIED_LOOPBACK && !rules.includes("<-loopback>"))
|
|
461
|
+
rules.push("<-loopback>");
|
|
462
|
+
return ["--proxy-bypass-list=" + [...rules, rule].join(";")];
|
|
463
|
+
}
|
|
464
|
+
/** The wait for a seeded CRLSet: {@link beforeLaunch} (the probe server, so its port can bypass the proxy),
|
|
465
|
+
* then {@link wait} once the context is up, or {@link close} if the launch failed. */
|
|
466
|
+
export class CrlsetReadiness {
|
|
467
|
+
timeout;
|
|
468
|
+
sequence;
|
|
469
|
+
quiet;
|
|
470
|
+
server;
|
|
471
|
+
constructor(timeout, sequence, quiet) {
|
|
472
|
+
this.timeout = timeout;
|
|
473
|
+
this.sequence = sequence;
|
|
474
|
+
this.quiet = quiet;
|
|
475
|
+
}
|
|
476
|
+
/** Start the probe server; resolves to the launch args to append (the proxy bypass for its port). */
|
|
477
|
+
async beforeLaunch(pwOptions) {
|
|
478
|
+
try {
|
|
479
|
+
this.server = await ProbeServer.start();
|
|
480
|
+
return proxyBypassArgs(pwOptions, this.server.url.slice("http://".length).replace(/\/+$/, ""));
|
|
481
|
+
}
|
|
482
|
+
catch (e) {
|
|
483
|
+
warnOnce("probe", `readiness probe unavailable (${errName(e)}: ${errText(e)})`, this.quiet);
|
|
484
|
+
this.close();
|
|
485
|
+
return [];
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
/** Hold the first tab on about:blank until the CRLSet is live. true when confirmed; false on timeout or
|
|
489
|
+
* error (warned once). See the comment at the top of this file for the signal. */
|
|
490
|
+
async wait(context) {
|
|
491
|
+
const server = this.server;
|
|
492
|
+
if (!server || !context) {
|
|
493
|
+
this.close();
|
|
494
|
+
return false;
|
|
495
|
+
}
|
|
496
|
+
const deadline = performance.now() + this.timeout * 1000;
|
|
497
|
+
const state = new ReadinessState(server);
|
|
498
|
+
let cdp;
|
|
499
|
+
try {
|
|
500
|
+
const page = context.pages()[0] ?? (await context.newPage());
|
|
501
|
+
cdp = await context.newCDPSession(page);
|
|
502
|
+
let first = true;
|
|
503
|
+
while (performance.now() < deadline) {
|
|
504
|
+
if (state.histogram && state.startedAt === undefined) { // checked BEFORE the probe: see ReadinessState
|
|
505
|
+
try {
|
|
506
|
+
await cdp.send("Browser.getHistogram", { name: STARTUP_HISTOGRAM });
|
|
507
|
+
state.noteStartup(true, first, performance.now());
|
|
508
|
+
}
|
|
509
|
+
catch (e) { // not recorded yet, or the method is refused
|
|
510
|
+
if (!/cannot find histogram/i.test(errText(e)))
|
|
511
|
+
state.histogram = false;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
first = false;
|
|
515
|
+
await page.evaluate(probeJs, server.url);
|
|
516
|
+
if (state.ready(performance.now()))
|
|
517
|
+
return true;
|
|
518
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
519
|
+
}
|
|
520
|
+
warnOnce("timeout", `CRLSet not confirmed live within ${this.timeout} s; the browser may still trust revoked ` +
|
|
521
|
+
"certificates until it loads", this.quiet);
|
|
522
|
+
return false;
|
|
523
|
+
}
|
|
524
|
+
catch (e) {
|
|
525
|
+
warnOnce("wait", `readiness check failed (${errName(e)}: ${errText(e)})`, this.quiet);
|
|
526
|
+
return false;
|
|
527
|
+
}
|
|
528
|
+
finally {
|
|
529
|
+
await cdp?.detach().catch(() => undefined); // the browser may be gone
|
|
530
|
+
this.close();
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
close() {
|
|
534
|
+
if (this.server) {
|
|
535
|
+
try {
|
|
536
|
+
this.server.close();
|
|
537
|
+
}
|
|
538
|
+
catch {
|
|
539
|
+
/* already closed */
|
|
540
|
+
}
|
|
541
|
+
this.server = undefined;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
//# sourceMappingURL=crlset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crlset.js","sourceRoot":"","sources":["../src/crlset.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,EAAE;AACF,qGAAqG;AACrG,+GAA+G;AAC/G,4FAA4F;AAC5F,8GAA8G;AAC9G,mGAAmG;AACnG,EAAE;AACF,sDAAsD;AACtD,EAAE;AACF,sGAAsG;AACtG,6GAA6G;AAC7G,0GAA0G;AAC1G,uCAAuC;AACvC,2GAA2G;AAC3G,qGAAqG;AACrG,uEAAuE;AACvE,+GAA+G;AAC/G,wGAAwG;AACxG,6GAA6G;AAC7G,4GAA4G;AAC5G,EAAE;AACF,yGAAyG;AACzG,yGAAyG;AACzG,6GAA6G;AAC7G,4GAA4G;AAC5G,yGAAyG;AACzG,qFAAqF;AACrF,EAAE;AACF,iGAAiG;AACjG,uGAAuG;AACvG,yGAAyG;AACzG,yGAAyG;AACzG,oGAAoG;AACpG,wGAAwG;AACxG,2GAA2G;AAE3G,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAe,MAAM,WAAW,CAAC;AAEtD,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,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AC,CAAC;YACtF,OAAO,KAAK,CAAC;QACf,CAAC;gBAAS,CAAC;YACT,MAAM,GAAG,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,0BAA0B;YACtE,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC;gBACH,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACtB,CAAC;YAAC,MAAM,CAAC;gBACP,oBAAoB;YACtB,CAAC;YACD,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QAC1B,CAAC;IACH,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { type AgentOptions } from "./agent.js";
|
|
|
8
8
|
import { Profile } from "./profile.js";
|
|
9
9
|
import { type AutoOptions } from "./profileauto.js";
|
|
10
10
|
import { fetchWidevine, seedWidevine } from "./widevine.js";
|
|
11
|
+
import { fetchCrlset, installCrlset, type CrlsetOption } from "./crlset.js";
|
|
11
12
|
import { type ShaderDialect } from "./shaderdialect.js";
|
|
12
13
|
import { type LicenseOptions, type LeaseSession } from "./license.js";
|
|
13
14
|
export { OfflineKeyError, offlineLease, loadOfflineKey, OFFLINE_KEY_ENV } from "./offline.js";
|
|
@@ -40,6 +41,7 @@ export { resolveAuto, resolveLocal, loadLocalIndex, localSetupHint, engineSuppor
|
|
|
40
41
|
export { runAgentTask, agentArgs, OPENROUTER_BASE_URL, type AgentOptions, type AgentTaskOptions, type AgentTaskResult, type AgentStep, } from "./agent.js";
|
|
41
42
|
export { RELEASE } from "./release.js";
|
|
42
43
|
export { fetchWidevine, seedWidevine } from "./widevine.js";
|
|
44
|
+
export { fetchCrlset, installCrlset } from "./crlset.js";
|
|
43
45
|
export { checkRenderCoherence, type RenderVerdict } from "./render.js";
|
|
44
46
|
export { resolveLicenseKey, acquireLease, getSessionSeats, saveLicenseKey, removeLicenseKey, licenseKeySource, licenseKeyPath, type SessionSeats, LicenseError, ConcurrencyLimitError, LicenseRevokedError, LicenseServerChallengeError, type LicenseOptions, type LeaseSession, } from "./license.js";
|
|
45
47
|
/** When true (and a proxy is set), resolve the proxy's exit-IP geo and auto-fill any unset
|
|
@@ -166,6 +168,23 @@ interface WidevineOption {
|
|
|
166
168
|
*/
|
|
167
169
|
widevine?: boolean;
|
|
168
170
|
}
|
|
171
|
+
/** Chrome's certificate revocation list (CRLSet), see ./crlset.ts. */
|
|
172
|
+
interface CrlsetLaunchOption {
|
|
173
|
+
/**
|
|
174
|
+
* CRLSET (opt-in). The engine never downloads Chrome's certificate revocation list (CRLSet), so revoked
|
|
175
|
+
* or distrusted CA keys stay trusted. `true` (or CLEARCOTE_CRLSET=1) seeds the current CRLSet into the
|
|
176
|
+
* profile (fetched from Google's component updater on first use, cached in ~/.clearcote/crlset,
|
|
177
|
+
* refreshed every 6 h) and the launch waits, a few seconds, until the engine has it live. `"nowait"`
|
|
178
|
+
* seeds without waiting (live once the first tab has been idle for a moment), `"<path>"` seeds that
|
|
179
|
+
* file (a crl-set file or a component directory). Needs a profile: launch() (its throwaway profile),
|
|
180
|
+
* `userDataDir` and launchPersistentContext() take it; `ephemeralProfile: false` launches without one
|
|
181
|
+
* and says so. Never fails a launch: without a CRLSet it warns once and goes on.
|
|
182
|
+
*/
|
|
183
|
+
crlset?: CrlsetOption;
|
|
184
|
+
/** How long the launch waits for the seeded CRLSet to be live, in seconds (default
|
|
185
|
+
* CLEARCOTE_CRLSET_TIMEOUT, else 15). */
|
|
186
|
+
crlsetTimeout?: number;
|
|
187
|
+
}
|
|
169
188
|
/** Opt-in SOCKS5 UDP relaying (see {@link socks5UdpArgs}). */
|
|
170
189
|
interface Socks5UdpOption {
|
|
171
190
|
/** Relay WebRTC's UDP through the SOCKS5 proxy using UDP ASSOCIATE, instead of letting it egress
|
|
@@ -191,10 +210,10 @@ interface CloudSwitchOption {
|
|
|
191
210
|
apiUrl?: string;
|
|
192
211
|
}
|
|
193
212
|
/** Options for {@link launch}: Playwright launch options + Clearcote fingerprint + agent + download options. */
|
|
194
|
-
export interface LaunchOptions extends PlaywrightLaunchOptions, FingerprintOptions, AgentOptions, GeoipOption, ProfileOption, ExtensionsOption, EphemeralProfileOption, HumanizeLaunchOptions, DownloadOptions, LicenseOptions, ShaderDialectOption, PersonaEnvOption, FontDirsOption, Socks5UdpOption, EngineExtrasOption, CloudSwitchOption, DockerOption, WidevineOption {
|
|
213
|
+
export interface LaunchOptions extends PlaywrightLaunchOptions, FingerprintOptions, AgentOptions, GeoipOption, ProfileOption, ExtensionsOption, EphemeralProfileOption, HumanizeLaunchOptions, DownloadOptions, LicenseOptions, ShaderDialectOption, PersonaEnvOption, FontDirsOption, Socks5UdpOption, EngineExtrasOption, CloudSwitchOption, DockerOption, WidevineOption, CrlsetLaunchOption {
|
|
195
214
|
}
|
|
196
215
|
/** Options for {@link launchPersistentContext}. */
|
|
197
|
-
export interface PersistentContextOptions extends PlaywrightLaunchOptions, BrowserContextOptions, FingerprintOptions, AgentOptions, GeoipOption, ProfileOption, ExtensionsOption, HumanizeLaunchOptions, DownloadOptions, LicenseOptions, ShaderDialectOption, PersonaEnvOption, FontDirsOption, Socks5UdpOption, EngineExtrasOption, CloudSwitchOption, WidevineOption {
|
|
216
|
+
export interface PersistentContextOptions extends PlaywrightLaunchOptions, BrowserContextOptions, FingerprintOptions, AgentOptions, GeoipOption, ProfileOption, ExtensionsOption, HumanizeLaunchOptions, DownloadOptions, LicenseOptions, ShaderDialectOption, PersonaEnvOption, FontDirsOption, Socks5UdpOption, EngineExtrasOption, CloudSwitchOption, WidevineOption, CrlsetLaunchOption {
|
|
198
217
|
}
|
|
199
218
|
/**
|
|
200
219
|
* Fill unset timezone/acceptLanguage/location/webrtcIp on `fp` from the proxy's exit-IP geo.
|
|
@@ -454,6 +473,8 @@ declare const _default: {
|
|
|
454
473
|
loadProfile: typeof loadProfile;
|
|
455
474
|
fetchWidevine: typeof fetchWidevine;
|
|
456
475
|
seedWidevine: typeof seedWidevine;
|
|
476
|
+
fetchCrlset: typeof fetchCrlset;
|
|
477
|
+
installCrlset: typeof installCrlset;
|
|
457
478
|
Cloud: typeof Cloud;
|
|
458
479
|
verifyWebhook: typeof verifyWebhook;
|
|
459
480
|
RELEASE: import("./release.js").ReleaseInfo;
|