Lines 48-88javascript
48* Validate and normalize a mount prefix before interpolating into shell commands.
49* Returns the normalized prefix (no leading/trailing slashes).
51* Shell safety is handled by shellQuote() at the call site, so this function
52* only enforces path-level rules (no traversal, no empty result, no control chars).
54function validatePrefix(prefix) {
55 let normalized = prefix;
56 while (normalized.startsWith("/")) normalized = normalized.slice(1);
57 while (normalized.endsWith("/")) normalized = normalized.slice(0, -1);
58 if (!normalized) throw new Error("Mount prefix cannot be empty after normalization.");
59 if (normalized.includes("//") || normalized.split("/").some((s) => s === "." || s === "..")) throw new Error(`Invalid mount prefix: "${
60 if (/[\x00-\x1f\x7f]/.test(normalized)) throw new Error(`Invalid mount prefix: "${prefix}". Control characters are not allowed.`);
64* Run a command in the Daytona sandbox.
66* Thin wrapper around `sandbox.process.executeCommand` that converts timeout
67* from milliseconds to seconds and null-coalesces the output string.
69* Does NOT throw on non-zero exit codes — callers should check `exitCode`.
70*/
LowWeak Crypto
Package source references weak cryptographic algorithms.
dist/index.jsView on unpkg · L68 71async function runCommand(sandbox, command, options) {
72 const result = await sandbox.process.executeCommand(command, void 0, void 0, options?.timeout !== void 0 ? Math.ceil(options.timeout / 1e3) : void
74 exitCode: result.exitCode,
75 output: result.result ?? ""
79//#region src/sandbox/mounts/s3.ts
81* Mount an S3 bucket using s3fs-fuse.
83async function mountS3(mountPath, config, ctx) {
84 const { run, writeFile, logger } = ctx;
85 validateS3BucketName(config.bucket);
86 if (config.endpoint) validateEndpoint(config.endpoint);
87 const quotedMountPath = shellQuote(mountPath);
88 const hasAccessKey = !!config.accessKeyId;