rechrome 1.43.0 → 1.43.1
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/fill-secret.js +8 -6
- package/fill-secret.ts +8 -6
- package/package.json +1 -1
package/fill-secret.js
CHANGED
|
@@ -505,13 +505,15 @@ function buildReadCookieCode(name, domain, allowDomains) {
|
|
|
505
505
|
const dom = ${JSON.stringify(domain.toLowerCase())}.replace(/^\\./, "");
|
|
506
506
|
if (!allowed.some(p => new RegExp(p, "i").test(dom)))
|
|
507
507
|
throw new Error("read-cookie refused: domain " + JSON.stringify(dom) + " is not allowed by --allow-domain");
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
const
|
|
508
|
+
// All cookies, any path (a URL filter would drop /app-scoped ones). Domain-match per RFC6265:
|
|
509
|
+
// the cookie's own domain is dom, or a parent of dom (a ".slack.com" cookie serves a subdomain).
|
|
510
|
+
const cookies = await page.context().cookies();
|
|
511
|
+
const domainMatches = cd => { cd = String(cd).replace(/^\\./, "").toLowerCase(); return dom === cd || dom.endsWith("." + cd); };
|
|
512
|
+
const match = cookies.filter(c => c.name === ${JSON.stringify(name)} && domainMatches(c.domain));
|
|
511
513
|
if (!match.length) throw new Error("read-cookie: no cookie " + JSON.stringify(${JSON.stringify(name)}) + " for " + dom + " (is this profile signed in?)");
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
return JSON.stringify({ domain: dom, value });
|
|
514
|
+
const values = [...new Set(match.map(c => { try { return String(c.value); } catch { return null; } }))];
|
|
515
|
+
if (values.length !== 1 || values[0] == null) throw new Error("read-cookie: " + match.length + " cookies named " + JSON.stringify(${JSON.stringify(name)}) + " for " + dom + " disagree; narrow the domain");
|
|
516
|
+
return JSON.stringify({ domain: dom, value: values[0] });
|
|
515
517
|
}`;
|
|
516
518
|
}
|
|
517
519
|
async function readCookieOnSession(opts) {
|
package/fill-secret.ts
CHANGED
|
@@ -512,13 +512,15 @@ export function buildReadCookieCode(name: string, domain: string, allowDomains:
|
|
|
512
512
|
const dom = ${JSON.stringify(domain.toLowerCase())}.replace(/^\\./, "");
|
|
513
513
|
if (!allowed.some(p => new RegExp(p, "i").test(dom)))
|
|
514
514
|
throw new Error("read-cookie refused: domain " + JSON.stringify(dom) + " is not allowed by --allow-domain");
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
const
|
|
515
|
+
// All cookies, any path (a URL filter would drop /app-scoped ones). Domain-match per RFC6265:
|
|
516
|
+
// the cookie's own domain is dom, or a parent of dom (a ".slack.com" cookie serves a subdomain).
|
|
517
|
+
const cookies = await page.context().cookies();
|
|
518
|
+
const domainMatches = cd => { cd = String(cd).replace(/^\\./, "").toLowerCase(); return dom === cd || dom.endsWith("." + cd); };
|
|
519
|
+
const match = cookies.filter(c => c.name === ${JSON.stringify(name)} && domainMatches(c.domain));
|
|
518
520
|
if (!match.length) throw new Error("read-cookie: no cookie " + JSON.stringify(${JSON.stringify(name)}) + " for " + dom + " (is this profile signed in?)");
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
return JSON.stringify({ domain: dom, value });
|
|
521
|
+
const values = [...new Set(match.map(c => { try { return String(c.value); } catch { return null; } }))];
|
|
522
|
+
if (values.length !== 1 || values[0] == null) throw new Error("read-cookie: " + match.length + " cookies named " + JSON.stringify(${JSON.stringify(name)}) + " for " + dom + " disagree; narrow the domain");
|
|
523
|
+
return JSON.stringify({ domain: dom, value: values[0] });
|
|
522
524
|
}`;
|
|
523
525
|
}
|
|
524
526
|
|