@mastra/e2b 0.8.1 → 0.8.2-alpha.0
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/CHANGELOG.md +9 -0
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/sandbox/mounts/types.d.ts +2 -1
- package/dist/sandbox/mounts/types.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -49,13 +49,13 @@ function createDefaultMountableTemplate() {
|
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/sandbox/mounts/types.ts
|
|
51
51
|
const LOG_PREFIX = "[@mastra/e2b]";
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
function
|
|
58
|
-
if (!
|
|
52
|
+
const SAFE_S3_BUCKET_NAME = /^[a-z0-9][a-z0-9.\-]{1,61}[a-z0-9]$/;
|
|
53
|
+
const SAFE_GCS_BUCKET_NAME = /^[a-z0-9][a-z0-9._-]{1,61}[a-z0-9]$/;
|
|
54
|
+
function validateS3BucketName(bucket) {
|
|
55
|
+
if (!SAFE_S3_BUCKET_NAME.test(bucket)) throw new Error(`Invalid S3 bucket name: "${bucket}". Bucket names must be 3-63 characters, lowercase alphanumeric, hyphens, or dots.`);
|
|
56
|
+
}
|
|
57
|
+
function validateGCSBucketName(bucket) {
|
|
58
|
+
if (!SAFE_GCS_BUCKET_NAME.test(bucket)) throw new Error(`Invalid GCS bucket name: "${bucket}". Bucket names must be 3-63 characters, lowercase alphanumeric, hyphens, underscores, or dots.`);
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Validate an endpoint URL before interpolating into shell commands.
|
|
@@ -110,7 +110,7 @@ function shellQuote(arg) {
|
|
|
110
110
|
*/
|
|
111
111
|
async function mountS3(mountPath, config, ctx) {
|
|
112
112
|
const { sandbox, logger } = ctx;
|
|
113
|
-
|
|
113
|
+
validateS3BucketName(config.bucket);
|
|
114
114
|
validateRegion(config.region);
|
|
115
115
|
if (config.endpoint) validateEndpoint(config.endpoint);
|
|
116
116
|
if ((await sandbox.commands.run("which s3fs || echo \"not found\"")).stdout.includes("not found")) {
|
|
@@ -198,7 +198,7 @@ Error details: ${installResult.stderr || installResult.stdout}`);
|
|
|
198
198
|
*/
|
|
199
199
|
async function mountGCS(mountPath, config, ctx) {
|
|
200
200
|
const { sandbox, logger } = ctx;
|
|
201
|
-
|
|
201
|
+
validateGCSBucketName(config.bucket);
|
|
202
202
|
if ((await sandbox.commands.run("which gcsfuse || echo \"not found\"")).stdout.includes("not found")) {
|
|
203
203
|
const codename = (await sandbox.commands.run("lsb_release -cs 2>/dev/null || echo jammy")).stdout.trim() || "jammy";
|
|
204
204
|
await sandbox.commands.run(`curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/gcsfuse.gpg && echo "deb [signed-by=/etc/apt/keyrings/gcsfuse.gpg] https://packages.cloud.google.com/apt gcsfuse-${codename} main" | sudo tee /etc/apt/sources.list.d/gcsfuse.list && sudo apt-get update && sudo apt-get install -y gcsfuse`, { timeoutMs: 12e4 });
|