@opengeni/runtime 0.14.0 → 0.14.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/{chunk-3NUSY22C.js → chunk-HHWIZHQM.js} +26 -9
- package/dist/chunk-HHWIZHQM.js.map +1 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.js +6 -7
- package/dist/index.js.map +1 -1
- package/dist/sandbox/index.js +1 -1
- package/package.json +3 -3
- package/src/context-compaction.ts +0 -5
- package/src/index.ts +9 -3
- package/src/sandbox/toolspace-token.ts +36 -12
- package/dist/chunk-3NUSY22C.js.map +0 -1
|
@@ -19458,6 +19458,7 @@ function withRunCredentialsClient(client, sessionId, onSessionReady) {
|
|
|
19458
19458
|
import { createHash as createHash5 } from "crypto";
|
|
19459
19459
|
import { posix as posixPath } from "path";
|
|
19460
19460
|
var MAX_TOOLSPACE_SESSION_ID_BYTES = 512;
|
|
19461
|
+
var HOME_RELATIVE_TOOLSPACE_PREFIX = "$HOME/";
|
|
19461
19462
|
var ToolspaceTokenPathError = class extends Error {
|
|
19462
19463
|
constructor(message) {
|
|
19463
19464
|
super(message);
|
|
@@ -19473,11 +19474,29 @@ function assertToolspaceSessionId(sessionId) {
|
|
|
19473
19474
|
}
|
|
19474
19475
|
return sessionId;
|
|
19475
19476
|
}
|
|
19476
|
-
function
|
|
19477
|
-
if (!
|
|
19478
|
-
|
|
19477
|
+
function isHomeRelativeToolspacePath(value) {
|
|
19478
|
+
if (!value.startsWith(HOME_RELATIVE_TOOLSPACE_PREFIX)) return false;
|
|
19479
|
+
const relative4 = value.slice(HOME_RELATIVE_TOOLSPACE_PREFIX.length);
|
|
19480
|
+
const segments = relative4.split("/");
|
|
19481
|
+
return relative4.length > 0 && !relative4.includes("\0") && segments.every(
|
|
19482
|
+
(segment) => segment !== "." && segment !== ".." && /^[A-Za-z0-9._-]+$/.test(segment)
|
|
19483
|
+
) && posixPath.normalize(relative4) === relative4;
|
|
19484
|
+
}
|
|
19485
|
+
function assertToolspaceFilePath(value, label) {
|
|
19486
|
+
if (!value || value.includes("\0") || !posixPath.isAbsolute(value) && !isHomeRelativeToolspacePath(value)) {
|
|
19487
|
+
throw new ToolspaceTokenPathError(`${label} must be absolute or use the trusted $HOME/ prefix`);
|
|
19479
19488
|
}
|
|
19480
|
-
|
|
19489
|
+
return posixPath.isAbsolute(value) ? posixPath.normalize(value) : value;
|
|
19490
|
+
}
|
|
19491
|
+
function shellToolspacePath(value) {
|
|
19492
|
+
const validated = assertToolspaceFilePath(value, "Toolspace token file");
|
|
19493
|
+
return isHomeRelativeToolspacePath(validated) ? `"${validated}"` : shellQuote5(validated);
|
|
19494
|
+
}
|
|
19495
|
+
function toolspaceTokenFileForSession(manifestTokenFile, sessionId) {
|
|
19496
|
+
const normalizedManifestFile = assertToolspaceFilePath(
|
|
19497
|
+
manifestTokenFile,
|
|
19498
|
+
"Toolspace manifest token file"
|
|
19499
|
+
);
|
|
19481
19500
|
const digest = createHash5("sha256").update(assertToolspaceSessionId(sessionId)).digest("hex");
|
|
19482
19501
|
return posixPath.join(posixPath.dirname(normalizedManifestFile), "toolspace-tokens", digest);
|
|
19483
19502
|
}
|
|
@@ -19486,10 +19505,7 @@ function toolspaceTokenFileFromEnvironment(environment, sessionId) {
|
|
|
19486
19505
|
return toolspaceTokenFileForSession(manifestTokenFile, sessionId);
|
|
19487
19506
|
}
|
|
19488
19507
|
function withToolspaceTokenEnvironment(cmd, tokenFile) {
|
|
19489
|
-
|
|
19490
|
-
throw new ToolspaceTokenPathError("Toolspace token file must be absolute");
|
|
19491
|
-
}
|
|
19492
|
-
return [`export OPENGENI_TOOLSPACE_TOKEN_FILE=${shellQuote5(tokenFile)}`, cmd].join("\n");
|
|
19508
|
+
return [`export OPENGENI_TOOLSPACE_TOKEN_FILE=${shellToolspacePath(tokenFile)}`, cmd].join("\n");
|
|
19493
19509
|
}
|
|
19494
19510
|
function withToolspaceTokenSession(session, tokenFile) {
|
|
19495
19511
|
return new Proxy(session, {
|
|
@@ -23984,6 +24000,7 @@ export {
|
|
|
23984
24000
|
withRunCredentialsSession,
|
|
23985
24001
|
withRunCredentialsClient,
|
|
23986
24002
|
ToolspaceTokenPathError,
|
|
24003
|
+
shellToolspacePath,
|
|
23987
24004
|
toolspaceTokenFileForSession,
|
|
23988
24005
|
toolspaceTokenFileFromEnvironment,
|
|
23989
24006
|
withToolspaceTokenEnvironment,
|
|
@@ -24048,4 +24065,4 @@ export {
|
|
|
24048
24065
|
collectSandboxEnvironment2 as collectSandboxEnvironment,
|
|
24049
24066
|
parseExposedPorts2 as parseExposedPorts
|
|
24050
24067
|
};
|
|
24051
|
-
//# sourceMappingURL=chunk-
|
|
24068
|
+
//# sourceMappingURL=chunk-HHWIZHQM.js.map
|