@cloudflare/sandbox 0.0.0-f106fda → 0.0.0-f5fcd52

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @cloudflare/sandbox
2
2
 
3
+ ## 0.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#20](https://github.com/cloudflare/sandbox-sdk/pull/20) [`f106fda`](https://github.com/cloudflare/sandbox-sdk/commit/f106fdac98e7ef35677326290d45cbf3af88982c) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - add preview URLs and dynamic port forwarding
8
+
3
9
  ## 0.0.8
4
10
 
5
11
  ### Patch Changes
@@ -400,34 +400,6 @@ async function handleExecuteRequest(
400
400
  );
401
401
  }
402
402
 
403
- // Basic safety check - prevent dangerous commands
404
- const dangerousCommands = [
405
- "rm",
406
- "rmdir",
407
- "del",
408
- "format",
409
- "shutdown",
410
- "reboot",
411
- ];
412
- const lowerCommand = command.toLowerCase();
413
-
414
- if (
415
- dangerousCommands.some((dangerous) => lowerCommand.includes(dangerous))
416
- ) {
417
- return new Response(
418
- JSON.stringify({
419
- error: "Dangerous command not allowed",
420
- }),
421
- {
422
- headers: {
423
- "Content-Type": "application/json",
424
- ...corsHeaders,
425
- },
426
- status: 400,
427
- }
428
- );
429
- }
430
-
431
403
  console.log(`[Server] Executing command: ${command} ${args.join(" ")}`);
432
404
 
433
405
  const result = await executeCommand(command, args, sessionId, background);
@@ -490,34 +462,6 @@ async function handleStreamingExecuteRequest(
490
462
  );
491
463
  }
492
464
 
493
- // Basic safety check - prevent dangerous commands
494
- const dangerousCommands = [
495
- "rm",
496
- "rmdir",
497
- "del",
498
- "format",
499
- "shutdown",
500
- "reboot",
501
- ];
502
- const lowerCommand = command.toLowerCase();
503
-
504
- if (
505
- dangerousCommands.some((dangerous) => lowerCommand.includes(dangerous))
506
- ) {
507
- return new Response(
508
- JSON.stringify({
509
- error: "Dangerous command not allowed",
510
- }),
511
- {
512
- headers: {
513
- "Content-Type": "application/json",
514
- ...corsHeaders,
515
- },
516
- status: 400,
517
- }
518
- );
519
- }
520
-
521
465
  console.log(
522
466
  `[Server] Executing streaming command: ${command} ${args.join(" ")}`
523
467
  );
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@cloudflare/sandbox",
3
- "version": "0.0.0-f106fda",
3
+ "version": "0.0.0-f5fcd52",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cloudflare/sandbox-sdk"
7
7
  },
8
8
  "description": "A sandboxed environment for running commands",
9
9
  "dependencies": {
10
- "@cloudflare/containers": "^0.0.23"
10
+ "@cloudflare/containers": "^0.0.24"
11
11
  },
12
12
  "tags": [
13
13
  "sandbox",
package/src/sandbox.ts CHANGED
@@ -55,6 +55,12 @@ export class Sandbox<Env = unknown> extends Container<Env> {
55
55
  }
56
56
  }
57
57
 
58
+ // RPC method to set environment variables
59
+ async setEnvVars(envVars: Record<string, string>): Promise<void> {
60
+ this.envVars = { ...this.envVars, ...envVars };
61
+ console.log(`[Sandbox] Updated environment variables`);
62
+ }
63
+
58
64
  override onStart() {
59
65
  console.log("Sandbox successfully started");
60
66
  }