@mastra/daytona 0.7.0 → 0.7.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/CHANGELOG.md +18 -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
|
@@ -23,13 +23,13 @@ function shellQuote(arg) {
|
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/sandbox/mounts/types.ts
|
|
25
25
|
const LOG_PREFIX = "[@mastra/daytona]";
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
function
|
|
32
|
-
if (!
|
|
26
|
+
const SAFE_S3_BUCKET_NAME = /^[a-z0-9][a-z0-9.\-]{1,61}[a-z0-9]$/;
|
|
27
|
+
const SAFE_GCS_BUCKET_NAME = /^[a-z0-9][a-z0-9._-]{1,61}[a-z0-9]$/;
|
|
28
|
+
function validateS3BucketName(bucket) {
|
|
29
|
+
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.`);
|
|
30
|
+
}
|
|
31
|
+
function validateGCSBucketName(bucket) {
|
|
32
|
+
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.`);
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Validate an endpoint URL before interpolating into shell commands.
|
|
@@ -82,7 +82,7 @@ async function runCommand(sandbox, command, options) {
|
|
|
82
82
|
*/
|
|
83
83
|
async function mountS3(mountPath, config, ctx) {
|
|
84
84
|
const { run, writeFile, logger } = ctx;
|
|
85
|
-
|
|
85
|
+
validateS3BucketName(config.bucket);
|
|
86
86
|
if (config.endpoint) validateEndpoint(config.endpoint);
|
|
87
87
|
const quotedMountPath = shellQuote(mountPath);
|
|
88
88
|
const hasAccessKey = !!config.accessKeyId;
|
|
@@ -153,7 +153,7 @@ async function mountS3(mountPath, config, ctx) {
|
|
|
153
153
|
*/
|
|
154
154
|
async function mountGCS(mountPath, config, ctx) {
|
|
155
155
|
const { run, writeFile, logger } = ctx;
|
|
156
|
-
|
|
156
|
+
validateGCSBucketName(config.bucket);
|
|
157
157
|
const quotedMountPath = shellQuote(mountPath);
|
|
158
158
|
const connectivityCheck = await run("curl -sS --max-time 5 http://storage.googleapis.com 2>&1", 1e4);
|
|
159
159
|
const checkOutput = connectivityCheck.stdout.trim();
|