@decocms/sandbox-controller 0.11.1 → 0.12.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/dist/index.d.ts CHANGED
@@ -3716,6 +3716,8 @@ interface DaemonAddress {
3716
3716
  */
3717
3717
 
3718
3718
  interface FreestyleSandboxProviderOptions {
3719
+ /** Allow nested user namespaces inside the VM's sandbox container. Default off. */
3720
+ allowUserNamespaces?: boolean;
3719
3721
  apiKey: string;
3720
3722
  /** The sandbox image. Default: the release built from this package's version. */
3721
3723
  image?: string;
@@ -3748,6 +3750,7 @@ declare class FreestyleSandboxProvider implements SandboxProvider {
3748
3750
  private readonly lookupClient;
3749
3751
  private readonly image;
3750
3752
  private readonly sidecarImage;
3753
+ private readonly allowUserNamespaces;
3751
3754
  private readonly idleTimeoutSeconds;
3752
3755
  private readonly idlePauseMs;
3753
3756
  private readonly autoDeleteSeconds;
package/dist/index.js CHANGED
@@ -6760,7 +6760,7 @@ var Freestyle = class {
6760
6760
  // ../sandbox/package.json
6761
6761
  var package_default = {
6762
6762
  name: "@decocms/sandbox",
6763
- version: "1.92.1",
6763
+ version: "1.93.0",
6764
6764
  private: true,
6765
6765
  type: "module",
6766
6766
  description: "Sandbox runtime for isolated Studio tool execution",
@@ -6878,6 +6878,7 @@ var FreestyleSandboxProvider = class {
6878
6878
  lookupClient;
6879
6879
  image;
6880
6880
  sidecarImage;
6881
+ allowUserNamespaces;
6881
6882
  idleTimeoutSeconds;
6882
6883
  idlePauseMs;
6883
6884
  autoDeleteSeconds;
@@ -6915,6 +6916,7 @@ var FreestyleSandboxProvider = class {
6915
6916
  });
6916
6917
  this.image = opts.image ?? `ghcr.io/decocms/studio/studio-sandbox-go:${package_default.version}`;
6917
6918
  this.sidecarImage = opts.orgFsSidecarImage ?? DEFAULT_SIDECAR_IMAGE;
6919
+ this.allowUserNamespaces = opts.allowUserNamespaces ?? false;
6918
6920
  this.idleTimeoutSeconds = opts.idleTimeoutSeconds ?? 5 * 60;
6919
6921
  this.idlePauseMs = opts.idlePauseMs ?? 10 * 6e4;
6920
6922
  this.autoDeleteSeconds = opts.autoDeleteSeconds ?? 24 * 60 * 60;
@@ -6979,9 +6981,10 @@ var FreestyleSandboxProvider = class {
6979
6981
  }
6980
6982
  baseSnapshot() {
6981
6983
  const { image, sidecarImage } = this;
6984
+ const namespaceMode = this.allowUserNamespaces ? "\nuser-namespaces" : "";
6982
6985
  const slug = `studio-sandbox-${createHash3("sha256").update(`${image}
6983
6986
  ${sidecarImage}
6984
- running`).digest("hex").slice(0, 16)}`;
6987
+ running${namespaceMode}`).digest("hex").slice(0, 16)}`;
6985
6988
  if (this.knownSnapshots.has(slug)) return Promise.resolve(slug);
6986
6989
  return this.snapshotInflight.run(slug, async () => {
6987
6990
  if (await this.snapshotExists(slug)) {
@@ -7044,7 +7047,8 @@ running`).digest("hex").slice(0, 16)}`;
7044
7047
  );
7045
7048
  await this.run(
7046
7049
  vm,
7047
- `docker run -d --name ${CONTAINER} --restart=always -p ${DAEMON_PORT}:${DAEMON_PORT} -v ${HOST_ORG_DIR}:${WORKDIR}/org:rslave -v ${HOST_CTL_DIR}:${CTL_DIR} ${envFlags} ${shellQuote(this.image)}`,
7050
+ // Codex's read-only sandbox uses bubblewrap inside this per-user VM.
7051
+ `docker run -d --name ${CONTAINER} --restart=always${this.allowUserNamespaces ? " --security-opt seccomp=unconfined --security-opt apparmor=unconfined" : ""} -p ${DAEMON_PORT}:${DAEMON_PORT} -v ${HOST_ORG_DIR}:${WORKDIR}/org:rslave -v ${HOST_CTL_DIR}:${CTL_DIR} ${envFlags} ${shellQuote(this.image)}`,
7048
7052
  { env, timeoutMs: IMAGE_PULL_TIMEOUT_MS }
7049
7053
  );
7050
7054
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/sandbox-controller",
3
- "version": "0.11.1",
3
+ "version": "0.12.0",
4
4
  "description": "Runs Studio agent sandboxes on Kubernetes, and serves them to a remote Studio.",
5
5
  "repository": {
6
6
  "type": "git",