Lines 54-94javascript
54 if (/[\x00-\x1f\x7f]/.test(normalized)) {
55 throw new Error(`Invalid mount prefix: "${prefix}". Control characters are not allowed.`);
60// src/utils/shell-quote.ts
61function shellQuote(arg) {
62 if (/^[a-zA-Z0-9._\-/@:=]+$/.test(arg)) return arg;
63 return "'" + arg.replace(/'/g, "'\\''") + "'";
66// src/sandbox/mounts/s3.ts
67async function mountS3(mountPath, config, ctx) {
68 const { sandbox, logger } = ctx;
69 validateBucketName(config.bucket);
70 validateRegion(config.region);
71 if (config.endpoint) {
72 validateEndpoint(config.endpoint);
74 const checkResult = await sandbox.commands.run('which s3fs || echo "not found"');
75 if (checkResult.stdout.includes("not found")) {
76 logger.warn(`${LOG_PREFIX} s3fs not found, attempting runtime installation...`);
LowWeak Crypto
Package source references weak cryptographic algorithms.
dist/index.jsView on unpkg · L74 78 `${LOG_PREFIX} Tip: For faster startup, use createMountableTemplate() to pre-install s3fs in your sandbox template`
80 await sandbox.commands.run("sudo apt-get update 2>&1", { timeoutMs: 6e4 });
81 const installResult = await sandbox.commands.run(
82 "sudo apt-get install -y s3fs fuse 2>&1 || sudo apt-get install -y s3fs-fuse fuse 2>&1",
85 if (installResult.exitCode !== 0) {
87 `Failed to install s3fs. For S3 mounting, your template needs s3fs and fuse packages.
89Option 1: Use createMountableTemplate() helper:
90 import { E2BSandbox, createMountableTemplate } from '@mastra/e2b';
91 const sandbox = new E2BSandbox({ template: createMountableTemplate() });
93Option 2: Customize the base template:
94 new E2BSandbox({ template: base => base.aptInstall(['your-packages']) })