levix-bot 2.1.1 → 2.1.2
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/app.cjs +13 -5
- package/package.json +1 -1
package/app.cjs
CHANGED
|
@@ -41,11 +41,11 @@ function isAllowedOrigin(origin, host) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
// Browsers may legitimately serialize the Origin header as the literal string
|
|
44
|
-
// "null" for a same-origin navigation in an opaque-origin context.
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
|
|
44
|
+
// "null" for a same-origin navigation in an opaque-origin context. Prefer
|
|
45
|
+
// Fetch Metadata when the browser sends it. Some Chromium form navigations omit
|
|
46
|
+
// Sec-Fetch-Site entirely, so only the two credential-gated auth forms get a
|
|
47
|
+
// narrow fallback for Origin:null; every other mutation remains strict.
|
|
48
|
+
const OPAQUE_ORIGIN_AUTH_PATHS = new Set(["/setup", "/login"]);
|
|
49
49
|
function isAllowedMutationRequest(req) {
|
|
50
50
|
const origin = req.get("origin");
|
|
51
51
|
const host = req.get("host");
|
|
@@ -58,6 +58,14 @@ function isAllowedMutationRequest(req) {
|
|
|
58
58
|
if (fetchSite === "same-origin") return true;
|
|
59
59
|
if (fetchSite === "cross-site") return false;
|
|
60
60
|
|
|
61
|
+
// Real Chromium can submit a top-level auth form with Origin:null and no
|
|
62
|
+
// Sec-Fetch-Site header. Setup is still protected by the one-time setup code
|
|
63
|
+
// for remote clients; login by the password; both share TCP-peer throttling.
|
|
64
|
+
// Do not generalize this exception to dashboard APIs or logout.
|
|
65
|
+
if (origin === "null" && !fetchSite && OPAQUE_ORIGIN_AUTH_PATHS.has(req.path)) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
61
69
|
return isAllowedOrigin(origin, host);
|
|
62
70
|
}
|
|
63
71
|
|