@infosupport/huddle-cli 0.0.0-experiment-160.130.1 → 0.0.0-experiment-160.132.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/dist/pipe/fs-list.js +24 -0
- package/dist/pipe/serve.js +2 -0
- package/package.json +1 -1
package/dist/pipe/fs-list.js
CHANGED
|
@@ -18,6 +18,7 @@ exports.isAbsoluteHostPath = isAbsoluteHostPath;
|
|
|
18
18
|
exports.hostRoots = hostRoots;
|
|
19
19
|
exports.listHostFolders = listHostFolders;
|
|
20
20
|
exports.fsList = fsList;
|
|
21
|
+
exports.fsResolve = fsResolve;
|
|
21
22
|
const fs_1 = __importDefault(require("fs"));
|
|
22
23
|
const os_1 = __importDefault(require("os"));
|
|
23
24
|
const path_1 = __importDefault(require("path"));
|
|
@@ -155,3 +156,26 @@ async function fsList(args, max = protocol_1.MAX_FOLDER_ENTRIES) {
|
|
|
155
156
|
throw new protocol_1.PipeError('bad_request', `not an absolute host path: ${raw}`);
|
|
156
157
|
return listHostFolders(toHuddlePath(raw), max);
|
|
157
158
|
}
|
|
159
|
+
const MAX_RESOLVE_PATHS = 64;
|
|
160
|
+
/**
|
|
161
|
+
* The `fs.resolve` op: where each path really is (links followed), or null when
|
|
162
|
+
* it does not exist. The portal cannot see host links, and a workspace that is a
|
|
163
|
+
* link into ~/.huddle would otherwise pass its lexical mount check.
|
|
164
|
+
*/
|
|
165
|
+
async function fsResolve(args) {
|
|
166
|
+
const raw = args.paths;
|
|
167
|
+
if (!Array.isArray(raw) || raw.length > MAX_RESOLVE_PATHS)
|
|
168
|
+
throw new protocol_1.PipeError('bad_request', `paths must be an array of at most ${MAX_RESOLVE_PATHS}`);
|
|
169
|
+
const paths = [];
|
|
170
|
+
for (const p of raw) {
|
|
171
|
+
if (typeof p !== 'string' || p.includes('\0') || !isAbsoluteHostPath(p))
|
|
172
|
+
throw new protocol_1.PipeError('bad_request', 'paths must be absolute host paths');
|
|
173
|
+
try {
|
|
174
|
+
paths.push(toHuddlePath(await fs_1.default.promises.realpath(p)));
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
paths.push(null);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return { paths };
|
|
181
|
+
}
|
package/dist/pipe/serve.js
CHANGED
|
@@ -38,6 +38,8 @@ async function dispatch(req, maxEntries) {
|
|
|
38
38
|
};
|
|
39
39
|
case 'fs.list':
|
|
40
40
|
return (0, fs_list_1.fsList)(args, maxEntries);
|
|
41
|
+
case 'fs.resolve':
|
|
42
|
+
return (0, fs_list_1.fsResolve)(args);
|
|
41
43
|
case 'tool.run':
|
|
42
44
|
return (0, tools_1.toolRun)(args);
|
|
43
45
|
case 'sbx.links':
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infosupport/huddle-cli",
|
|
3
|
-
"version": "0.0.0-experiment-160.
|
|
3
|
+
"version": "0.0.0-experiment-160.132.1",
|
|
4
4
|
"description": "Huddle CLI — start devcontainers and manage firewall rules",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"author": "Info Support B.V.",
|