@plitzi/sdk-server 0.38.18 → 0.38.19
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/CHANGELOG.md +28 -0
- package/dist/core/auth/csrf.d.ts +2 -2
- package/dist/core/auth/csrf.js +23 -12
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @plitzi/sdk-server
|
|
2
2
|
|
|
3
|
+
## 0.38.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 92a9f1b: ## Security
|
|
8
|
+
|
|
9
|
+
- **The `Origin` fallback tells the ports apart over HTTP/2 too** (`@plitzi/sdk-server`): a browser that sends no
|
|
10
|
+
`Sec-Fetch-Site` (Safari before 16.4, older webviews) is judged by its `Origin`, compared with the authority the
|
|
11
|
+
request was addressed to. HTTP/2 carries no `Host` header — the authority is `:authority` — and the comparison then
|
|
12
|
+
fell back to the host's NAME, so every port and scheme of it counted as this server's own: what 0.38.18 closed for
|
|
13
|
+
`same-site` stayed open there, over TLS, where a Plitzi server speaks HTTP/2. The authority is now `:authority`,
|
|
14
|
+
`Host`, or the `X-Forwarded-Host` a proxy in front wrote — whichever names the host the request is answered as — port
|
|
15
|
+
included; when none does, the origin is not taken as its own. The write guard (`crossSiteWrites`), the sign-in's
|
|
16
|
+
login-CSRF check and `createOriginGuardMiddleware` share it.
|
|
17
|
+
|
|
18
|
+
## Packages
|
|
19
|
+
- **The server evaluates rules without the query editor** (`@plitzi/sdk-shared`, `@plitzi/sdk-auth`,
|
|
20
|
+
`@plitzi/sdk-elements`, `@plitzi/sdk-interactions`, `@plitzi/plitzi-builder`): every evaluation of a `when` rule
|
|
21
|
+
group imports `QueryBuilderEvaluator` from `@plitzi/plitzi-ui/QueryBuilder/evaluator` — the evaluator alone — instead
|
|
22
|
+
of the `QueryBuilder` barrel, which brings the editor's React components, or `QueryBuilder/helpers`, which brings the
|
|
23
|
+
SQL and MongoDB formatters. `@plitzi/sdk-shared/helpers` reads `get` and `omit` from `@plitzi/plitzi-ui/helpers/lodash`.
|
|
24
|
+
Importing `@plitzi/sdk-server` loads 19 modules of `@plitzi/plitzi-ui` (26 before) and neither
|
|
25
|
+
`class-variance-authority` nor `clsx`, and starts in ~125 ms (~150 before). Needs `@plitzi/plitzi-ui` 1.6.34.
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [92a9f1b]
|
|
28
|
+
- @plitzi/plitzi-sdk@0.38.19
|
|
29
|
+
- @plitzi/sdk-shared@0.38.19
|
|
30
|
+
|
|
3
31
|
## 0.38.18
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/dist/core/auth/csrf.d.ts
CHANGED
|
@@ -67,8 +67,8 @@ export declare const carrierOf: (req: {
|
|
|
67
67
|
* `same-origin`, and `none` (a typed URL, a bookmark), are this server's own; `same-site` and `cross-site` are a
|
|
68
68
|
* page of another origin, foreign unless its origin was named.
|
|
69
69
|
* - **`Origin`** is the fallback, for a browser too old to send the above — Safari only did from 16.4. Matched
|
|
70
|
-
* **exactly** — host and port; one port does not serve two schemes — against
|
|
71
|
-
* named.
|
|
70
|
+
* **exactly** — host and port, over HTTP/1.1 and HTTP/2 alike; one port does not serve two schemes — against the
|
|
71
|
+
* authority the request was addressed to, or an origin the deployment named.
|
|
72
72
|
*
|
|
73
73
|
* **`same-site` is not trusted, and was once.** A site is a registrable domain, with no port in it: another port of
|
|
74
74
|
* this host, or a sibling sub-domain, is the same site. Both are where somebody else's code is served by design —
|
package/dist/core/auth/csrf.js
CHANGED
|
@@ -76,8 +76,12 @@ var readCookieHeader = (carrier, name) => {
|
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
/**
|
|
79
|
-
* Whether `origin` is the request's own: its host
|
|
80
|
-
* `Host`
|
|
79
|
+
* Whether `origin` is the request's own: its host AND port, as the request was addressed — HTTP/2's `:authority`, which
|
|
80
|
+
* carries no `Host` header at all; `Host` otherwise; and `X-Forwarded-Host` before both, which a proxy in front writes
|
|
81
|
+
* when it addresses this server by another name (a page cannot set it: no form or fetch of another origin sends it).
|
|
82
|
+
* The one whose host is the hostname the request is answered as is compared, port included. None of them is: nothing
|
|
83
|
+
* says which port the request reached, so the origin is not taken as its own — comparing the name alone made every port
|
|
84
|
+
* and every scheme of this host count.
|
|
81
85
|
*/
|
|
82
86
|
var isOwnOrigin = (origin, carrier) => {
|
|
83
87
|
let url;
|
|
@@ -86,15 +90,22 @@ var isOwnOrigin = (origin, carrier) => {
|
|
|
86
90
|
} catch {
|
|
87
91
|
return false;
|
|
88
92
|
}
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
const forwarded = header(carrier, "x-forwarded-host")?.split(",")[0]?.trim();
|
|
94
|
+
for (const authority of [
|
|
95
|
+
forwarded,
|
|
96
|
+
header(carrier, ":authority"),
|
|
97
|
+
header(carrier, "host")
|
|
98
|
+
]) {
|
|
99
|
+
if (!authority) continue;
|
|
100
|
+
let own;
|
|
101
|
+
try {
|
|
102
|
+
own = new URL(`${url.protocol}//${authority}`);
|
|
103
|
+
} catch {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (own.hostname === carrier.hostname) return url.host === own.host;
|
|
96
107
|
}
|
|
97
|
-
return
|
|
108
|
+
return false;
|
|
98
109
|
};
|
|
99
110
|
/**
|
|
100
111
|
* Did a page of another ORIGIN cause this request — `allowed` naming the origins this deployment counts as its own?
|
|
@@ -107,8 +118,8 @@ var isOwnOrigin = (origin, carrier) => {
|
|
|
107
118
|
* `same-origin`, and `none` (a typed URL, a bookmark), are this server's own; `same-site` and `cross-site` are a
|
|
108
119
|
* page of another origin, foreign unless its origin was named.
|
|
109
120
|
* - **`Origin`** is the fallback, for a browser too old to send the above — Safari only did from 16.4. Matched
|
|
110
|
-
* **exactly** — host and port; one port does not serve two schemes — against
|
|
111
|
-
* named.
|
|
121
|
+
* **exactly** — host and port, over HTTP/1.1 and HTTP/2 alike; one port does not serve two schemes — against the
|
|
122
|
+
* authority the request was addressed to, or an origin the deployment named.
|
|
112
123
|
*
|
|
113
124
|
* **`same-site` is not trusted, and was once.** A site is a registrable domain, with no port in it: another port of
|
|
114
125
|
* this host, or a sibling sub-domain, is the same site. Both are where somebody else's code is served by design —
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-server",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.19",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -111,12 +111,12 @@
|
|
|
111
111
|
"./dist/env.js"
|
|
112
112
|
],
|
|
113
113
|
"dependencies": {
|
|
114
|
-
"@plitzi/plitzi-sdk": "0.38.
|
|
115
|
-
"@plitzi/sdk-shared": "0.38.
|
|
116
|
-
"ejs": "^7.0.
|
|
114
|
+
"@plitzi/plitzi-sdk": "0.38.19",
|
|
115
|
+
"@plitzi/sdk-shared": "0.38.19",
|
|
116
|
+
"ejs": "^7.0.2",
|
|
117
117
|
"esbuild": "^0.28.2",
|
|
118
118
|
"jsonwebtoken": "^9.0.3",
|
|
119
|
-
"nodemailer": "^10.1.
|
|
119
|
+
"nodemailer": "^10.1.3",
|
|
120
120
|
"undici": "^8.12.2",
|
|
121
121
|
"ws": "^8.22.0"
|
|
122
122
|
},
|