@activeledger/activestorage 4.5.11 → 4.5.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@activeledger/activestorage",
3
- "version": "4.5.11",
3
+ "version": "4.5.13",
4
4
  "description": "This package is Activeledger's built-in data storage engine",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -35,17 +35,17 @@
35
35
  "author": "Activeledger",
36
36
  "license": "MIT",
37
37
  "devDependencies": {
38
- "@types/levelup": "5.1.1",
39
- "@types/node": "18.0.0",
38
+ "@types/levelup": "^5.1.5",
39
+ "@types/node": "24.10.1",
40
40
  "copyfiles": "2.4.1",
41
41
  "levelup": "5.1.1",
42
- "typescript": "4.7.3"
42
+ "typescript": "5.6.3"
43
43
  },
44
44
  "dependencies": {
45
- "@activeledger/activelogger": "4.5.11",
46
- "@activeledger/activeoptions": "4.5.11",
47
- "@activeledger/activeutilities": "4.5.11",
48
- "@activeledger/httpd": "4.5.11",
45
+ "@activeledger/activelogger": "4.5.13",
46
+ "@activeledger/activeoptions": "4.5.13",
47
+ "@activeledger/activeutilities": "4.5.13",
48
+ "@activeledger/httpd": "4.5.13",
49
49
  "classic-level": "^3.0.0"
50
50
  }
51
51
  }
package/src/datastore.ts CHANGED
@@ -112,6 +112,10 @@ export class ActiveDataStore {
112
112
  this.dsLocation,
113
113
  `${dbInfo.selfhost.port}`,
114
114
  `${dbInfo.selfhost.engine || "level"}`,
115
+ // db.selfhost.host has always existed and was only ever used as a
116
+ // client connection string; the server ignored it and bound every
117
+ // interface. Now it does what it looks like it does.
118
+ `${dbInfo.selfhost.host || "127.0.0.1"}`,
115
119
  ],
116
120
  {
117
121
  stdio: "inherit",
package/src/selfhost.ts CHANGED
@@ -45,6 +45,16 @@ import { IActiveHttpResponse } from "@activeledger/httpd/lib/httpd";
45
45
  // Data Storage Engine Provider, level provides backwards compatiblility
46
46
  const DS_PROVIDER = process.argv[4] || "level";
47
47
 
48
+ // Which interface to listen on. This store has no authentication of any
49
+ // kind - _bulk_docs will set any document to any revision, DELETE removes
50
+ // a stream or the whole database - so it should be reachable only by the
51
+ // node that owns it unless someone has deliberately decided otherwise.
52
+ //
53
+ // Local by default. An SSH tunnel still works (it connects from on the
54
+ // host), and so does a container sharing the node's network namespace,
55
+ // which is how the gateways reach it. Set db.selfhost.host to widen it.
56
+ const BIND_HOST = process.argv[5] || "127.0.0.1";
57
+
48
58
  // Database Connection Cache
49
59
  let dbCache: { [index: string]: LevelMe } = {};
50
60
 
@@ -1050,7 +1060,23 @@ import { IActiveHttpResponse } from "@activeledger/httpd/lib/httpd";
1050
1060
 
1051
1061
  // If path is not default overwrite
1052
1062
  if (req.url !== "/_utils/") {
1053
- file = FAUXTON_PATH + (req.url as string).replace("/_utils", "");
1063
+ // Resolved and contained, not concatenated. uWebSockets hands the
1064
+ // path through as sent, so "../" segments arrive verbatim - and
1065
+ // FAUXTON_PATH sits several levels inside the install, so a few of
1066
+ // them reach the node's working directory, where config.json and the
1067
+ // .identity private key live.
1068
+ const requested = path.resolve(
1069
+ FAUXTON_PATH,
1070
+ "." + decodeURIComponent((req.url as string).replace("/_utils", ""))
1071
+ );
1072
+
1073
+ if (!requested.startsWith(path.resolve(FAUXTON_PATH) + path.sep)) {
1074
+ // Outside the asset directory. Serve the app shell rather than
1075
+ // reporting whether the path existed.
1076
+ return fauxtonCache[FAUXTON_PATH + "/index.html"] || null;
1077
+ }
1078
+
1079
+ file = requested;
1054
1080
  }
1055
1081
 
1056
1082
  if (fauxtonCache[file]) {
@@ -1074,5 +1100,5 @@ import { IActiveHttpResponse } from "@activeledger/httpd/lib/httpd";
1074
1100
  http.use("_utils/**", "GET", fauxton);
1075
1101
 
1076
1102
  // Start Server
1077
- http.listen(parseInt(PORT));
1103
+ http.listen(parseInt(PORT), false, BIND_HOST);
1078
1104
  })();