@rynx-ai/server 0.1.11-beta.48 → 0.1.11-beta.49

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.
@@ -1154,16 +1154,29 @@ export class MachineSessionService {
1154
1154
  const sessionId = this.requireResourceSession(input.sessionId);
1155
1155
  const session = this.ports.registry.get(sessionId);
1156
1156
  try {
1157
- const workspaceRoot = await realpath(session.workspace.cwd);
1157
+ const workspaceRoot = await realpath(session.workspace.cwd).catch(() => undefined);
1158
1158
  const requestedPath = isAbsolute(input.path)
1159
1159
  ? input.path
1160
- : resolve(workspaceRoot, input.path);
1160
+ : resolve(workspaceRoot ?? session.workspace.cwd, input.path);
1161
1161
  const canonicalPath = await realpath(requestedPath);
1162
- const workspaceRelative = relative(workspaceRoot, canonicalPath);
1163
- if (!workspaceRelative ||
1164
- workspaceRelative === ".." ||
1165
- workspaceRelative.startsWith(`..${sep}`) ||
1166
- isAbsolute(workspaceRelative)) {
1162
+ let allowed = false;
1163
+ for (const directory of new Set([session.workspace.cwd, ...session.workspace.allowedDirs])) {
1164
+ // An unavailable root, including cwd, must not hide files in other roots.
1165
+ const root = directory === session.workspace.cwd
1166
+ ? workspaceRoot
1167
+ : await realpath(directory).catch(() => undefined);
1168
+ if (!root)
1169
+ continue;
1170
+ const workspaceRelative = relative(root, canonicalPath);
1171
+ if (workspaceRelative &&
1172
+ workspaceRelative !== ".." &&
1173
+ !workspaceRelative.startsWith(`..${sep}`) &&
1174
+ !isAbsolute(workspaceRelative)) {
1175
+ allowed = true;
1176
+ break;
1177
+ }
1178
+ }
1179
+ if (!allowed) {
1167
1180
  throw new MachineSessionServiceFailure("not_found", "Session workspace file was not found");
1168
1181
  }
1169
1182
  const fileStat = await stat(canonicalPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rynx-ai/server",
3
- "version": "0.1.11-beta.48",
3
+ "version": "0.1.11-beta.49",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/rynx-ai/rynx.git",
@@ -27,15 +27,15 @@
27
27
  "@koa/router": "^15.4.0",
28
28
  "koa": "^3.2.0",
29
29
  "ws": "^8.21.0",
30
- "@rynx-ai/core": "0.1.11-beta.48",
31
- "@rynx-ai/plugin-sdk": "0.1.11-beta.48",
32
- "@rynx-ai/protocol": "0.1.11-beta.48",
33
- "@rynx-ai/remote-runtime-e2ee": "0.1.11-beta.48",
34
- "@rynx-ai/runtime": "0.1.11-beta.48"
30
+ "@rynx-ai/core": "0.1.11-beta.49",
31
+ "@rynx-ai/plugin-sdk": "0.1.11-beta.49",
32
+ "@rynx-ai/protocol": "0.1.11-beta.49",
33
+ "@rynx-ai/remote-runtime-e2ee": "0.1.11-beta.49",
34
+ "@rynx-ai/runtime": "0.1.11-beta.49"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/ws": "^8.18.1",
38
- "@rynx-ai/control-web": "0.1.11-beta.48"
38
+ "@rynx-ai/control-web": "0.1.11-beta.49"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "rm -rf dist && tsc -p tsconfig.json && mkdir -p dist/control-web && cp -R ../control-web/dist/. dist/control-web/",