Restriction Mode

Restriction Mode applies to workspaces only.

When Restriction Mode is applied to a workspace in a sandbox, it blocks access to that workspace from non-admin users — including the sandbox owner — while mounting Admin Only secrets in that workspace.

This feature is designed for sandboxes that need to:

Lifetime

Restriction Mode can only be applied at workspace creation time. Once a workspace exits Restriction Mode, it can never re-enter it. There are two lifetime options:

Definition

Add the restriction field to a workspace definition:

workspaces:
- name: dev
- name: privileged
  restriction:
    life_time: ALWAYS

In this example, the dev workspace is accessible to the owner and non-admin users, while the privileged workspace is permanently inaccessible to non-admins. The processes running in privileged can provide services to dev without leaking access to sensitive secrets.

STARTUP Lifetime Example

workspaces:
- name: dev
  system:
    files:
    - path: /etc/sandbox.d/setup
      mode: '0700'
      content: |
        #!/bin/bash
        provision-resources /run/sandbox/fs/secrets/shared/provision-token
        cs sandbox restriction disable
  restriction:
    life_time: STARTUP

In this example, when the dev workspace starts:

  1. The setup script runs with the Admin Only secret provision-token mounted (because Restriction Mode is active).
  2. It uses the secret to provision external resources.
  3. It calls cs sandbox restriction disable to exit Restriction Mode.
  4. Admin Only secrets are unmounted.
  5. The workspace becomes accessible to non-admin users.

Interaction with Lockdown

If Lockdown is defined for the same workspace, Lockdown is not applied while the workspace is in Restriction Mode. This allows the workspace to make privileged API calls and access secrets during setup before lockdown takes effect.

See Also