taladb 0.7.10 → 0.8.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/dist/index.js +13 -0
- package/dist/index.mjs +13 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -42,6 +42,14 @@ var ENDPOINT_FIELDS = [
|
|
|
42
42
|
"update_endpoint",
|
|
43
43
|
"delete_endpoint"
|
|
44
44
|
];
|
|
45
|
+
var LOCALHOST_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]", "::1"]);
|
|
46
|
+
function isLocalhostUrl(url) {
|
|
47
|
+
try {
|
|
48
|
+
return LOCALHOST_HOSTS.has(new URL(url).hostname);
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
45
53
|
function validateConfig(config) {
|
|
46
54
|
const sync = config.sync;
|
|
47
55
|
if (!sync) return;
|
|
@@ -52,6 +60,11 @@ function validateConfig(config) {
|
|
|
52
60
|
`TalaDB config: invalid endpoint URL "${url}" \u2014 must start with http:// or https://`
|
|
53
61
|
);
|
|
54
62
|
}
|
|
63
|
+
if (url?.startsWith("http://") && !isLocalhostUrl(url)) {
|
|
64
|
+
console.warn(
|
|
65
|
+
`[TalaDB] sync endpoint "${url}" uses plaintext HTTP \u2014 use HTTPS in production to prevent changeset interception`
|
|
66
|
+
);
|
|
67
|
+
}
|
|
55
68
|
}
|
|
56
69
|
}
|
|
57
70
|
async function loadConfig(configPath) {
|
package/dist/index.mjs
CHANGED
|
@@ -5,6 +5,14 @@ var ENDPOINT_FIELDS = [
|
|
|
5
5
|
"update_endpoint",
|
|
6
6
|
"delete_endpoint"
|
|
7
7
|
];
|
|
8
|
+
var LOCALHOST_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]", "::1"]);
|
|
9
|
+
function isLocalhostUrl(url) {
|
|
10
|
+
try {
|
|
11
|
+
return LOCALHOST_HOSTS.has(new URL(url).hostname);
|
|
12
|
+
} catch {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
8
16
|
function validateConfig(config) {
|
|
9
17
|
const sync = config.sync;
|
|
10
18
|
if (!sync) return;
|
|
@@ -15,6 +23,11 @@ function validateConfig(config) {
|
|
|
15
23
|
`TalaDB config: invalid endpoint URL "${url}" \u2014 must start with http:// or https://`
|
|
16
24
|
);
|
|
17
25
|
}
|
|
26
|
+
if (url?.startsWith("http://") && !isLocalhostUrl(url)) {
|
|
27
|
+
console.warn(
|
|
28
|
+
`[TalaDB] sync endpoint "${url}" uses plaintext HTTP \u2014 use HTTPS in production to prevent changeset interception`
|
|
29
|
+
);
|
|
30
|
+
}
|
|
18
31
|
}
|
|
19
32
|
}
|
|
20
33
|
async function loadConfig(configPath) {
|