Updated on 2026-07-29 GMT+08:00

Sandbox

A sandbox provides an isolated and restricted execution space for instructions generated by agents. Through strict permission control, it ensures that commands run within a securely isolated environment. This effectively blocks access to unauthorized resources (such as files and networks) or the execution of high-risk commands (such as permission modification commands). For intercepted commands, the agent will issue a risk prompt within a chat. They will only be executed outside the sandbox after a secondary confirmation by the user.

Using a sandbox offers the following advantages:

  • Preventing data leakage: Based on sandbox technology, system-level and user-level sensitive directories are isolated, blocking data leakage risks at the source and comprehensively protecting core assets.
  • Preventing direct execution of high-risk commands: Commands are executed in a sandbox environment, where potentially dangerous operations (e.g., deleting all files on the D drive or modifying user permissions) can be identified and blocked in advance. A prompt is also generated in the chat flow for users to confirm whether to execute the commands.
  • Supporting enterprise compliance requirements: This mechanism meets stringent regulatory requirements for development environment file isolation in industries such as finance, healthcare, and government, reducing security concerns and accelerating enterprise procurement decisions.

Constraints

Table 1 Constraints

Category

Description

OS

  • Windows OS: Windows 11 (x64) is recommended. For Windows 10 (x64), the version must be 2019 or later, and upgrading to the latest stable version is advised.
  • macOS: macOS 11 or later, compatible with ARM64 (Apple Silicon).
  • Linux OS: Those on the x64 and ARM64 architectures are supported.

Controlled object

  • Windows: Only Bash and PowerShell commands are controlled.
  • macOS: Only Shell commands are controlled.
  • Linux: Only Shell commands are controlled.

File Access Control

After sandbox is enabled, the file and directory access permissions for CodeArts Agent are configured as follows. You can also configure the sandbox.json file to customize the file and network access scope of processes in the sandbox environment of the current project. For details, see 5.

Table 2 File access control

OS

Permission Type

Directory Type

Directory List

Windows

Read-only

-

All directories are readable except critical Windows system directories and sensitive user directories.

Read/Write

Project directories and their subdirectories

-

No read/No write

Critical Windows system directories

  • C:\Windows\System32\config
  • C:\Windows\System32\drivers\etc
  • C:\Windows\SysWOW64\config
  • C:\ProgramData\Microsoft\Crypto
  • C:\Windows\System32\GroupPolicy
  • C:\Windows\System32\GroupPolicyUsers
  • C:\ProgramData\Microsoft\Windows\WER

Sensitive user directories

  • C:\Users\*\AppData\Local\Microsoft\Credentials
  • C:\Users\*\AppData\Roaming\Microsoft\Credentials
  • C:\Users\*\AppData\Local\Microsoft\Protect
  • C:\Users\*\NTUSER.DAT
  • C:\Users\*\ntuser.dat.LOG

macOS

Read-only

-

All directories are readable except sensitive system directories.

Read/Write

Workspace and additionally configured directories

  • Temporary directories: /tmp, /var/folders, and TMPDIR environment variable paths
  • Cache directories: ~/Library/Caches and ~/.cache
  • Dependency directories of common tools: ~/.local/lib, ~/.local/bin, and ~/.local/share
  • Toolchain and dependency directories of common development languages (Go, Java, Python, Node.js, Rust, and Ruby)

No read/No write

Documents/Desktop/Downloads (privacy-related)

  • ~/Desktop
  • ~/Documents
  • ~/Downloads
  • ~/Pictures
  • ~/Movies
  • ~/.ssh
  • ~/.zsh_history

Password/Wallet/Keychain-related

~/Library/Keychains

System-level sensitive configuration

  • /etc/passwd
  • /private/etc/passwd
  • /etc/group
  • /private/etc/group
  • /etc/hosts
  • /private/etc/hosts
  • /etc/resolv.conf
  • /private/etc/resolv.conf
  • /etc/pam.d
  • /private/etc/pam.d

Linux

Read-only

-

All directories are readable except sensitive system directories.

Read/Write

Workspace and additionally configured directories

  • Temporary directories: /tmp and TMPDIR environment variable paths
  • Cache directories: ~/.cache and XDG_CACHE_HOME environment variable paths
  • Dependency directories of common tools: ~/.local/lib, ~/.local/bin, and ~/.local/share
  • Toolchain and dependency directories of common development languages (Go, Java, Python, Node.js, Rust, and Ruby)

No read/No write

Critical Linux system directories

  • /etc/shadow
  • /etc/passwd
  • /etc/group
  • /etc/gshadow
  • /etc/resolv.conf
  • /etc/sudoers

Enabling the Sandbox Mode

  1. Log in to CodeArts Agent IDE as instructed in Quick Start.
  2. Click in the upper right corner of CodeArts Agent IDE to open the settings page.
  3. Enable the sandbox mode.

    1. In the navigation pane on the left, choose Chats.
    2. Under Agents, select Running in Sandbox from the Terminal Command Running Mode drop-down list.
      Figure 1 Selecting Running in Sandbox

  4. Configure the command whitelist.

    This allows you to add the prefix of a specific command to the whitelist as required. Commands added to the whitelist bypass the sandbox mechanism and are executed outside the sandbox.

  5. Customize sandbox configuration.

    By configuring the sandbox.json file, you can customize files and the network access scopes for processes within the current project's sandbox environment.

    1. Click Open Configuration next to Sandbox Custom Configuration. The IDE will generate a sandbox.json file in your local user directory (%USERPROFILE%/.codeartsdoer) and automatically open it in the editor.
      The initial structure of the file is as follows:
      {
          "filesystem": {
              "readWrite": [],
              "readOnly": []
          },
          "network": {
              "default": "Allow",
              "allow": [],
              "deny": []
          },
          "resources": {
              "cpu": 50,
              "memory": 2
          }
      }
      Table 3 Parameters in the sandbox.json file

      Parameter

      Mandatory (Yes/No)

      Parameter Type

      Description

      filesystem

      No

      filesystem Object

      Used to precisely control the sandbox's access permissions to the local file system.

      If it is not set (the filesystem field is empty or does not exist), the sandbox's built-in file system security policy will be applied.

      network

      No

      network Object

      Used to control the network access policies for processes within the sandbox, supporting configurations to allow or block access to specific network resources.

      If it is not set, network access is allowed by default.

      resources

      No

      resources Object

      Used to define the maximum limit of computing resources during sandbox runtime, ensuring service stability and preventing resource abuse.

      If it is not set, the system will share the host machine's resources.

      Table 4 Parameters in filesystem

      Parameter

      Parameter Type

      Default Value

      Format of Supported Paths

      Priority Rule

      Description

      readWrite

      Array

      [ ]

      • Absolute path: for example, /home/user/project or C:\Projects
      • Relative path: for example, ./src or ./config
      • Environment variable: $HOME (Linux/Mac) or %USERPROFILE% (Windows)
      • Abbreviation of the home directory: ~

      readOnly > readWrite > Default system policy

      If a specific path matches both readOnly and readWrite, readOnly shall prevail.

      List of read/write paths.

      readOnly

      Array

      [ ]

      List of read-only paths.

      Table 5 Parameters in network

      Parameter

      Parameter Type

      Default Value

      Priority Rule

      Description

      default

      String

      Allow

      deny > allow > default

      If both allow and deny are configured, deny shall prevail.

      Default network access policy.

      • Allow: access allowed.
      • Deny: access denied.
      NOTE:

      This field supports two configuration formats: Domain:Port and IP address:Port. Wildcards are supported for the domain part, and CIDR notation is supported for IP addresses. Multiple ports can be configured by separating them with commas. If no port is specified, the rule applies to all ports by default.

      allow

      Array

      [ ]

      Network rules that allow access to processes in the sandbox.

      deny

      Array

      [ ]

      Network rules that reject access to processes in the sandbox.

      Table 6 Parameters in resources

      Parameter

      Parameter Type

      Default Value

      Min. Value

      Description

      cpu

      Integer

      50

      20

      CPU usage, in percentage.

      memory

      Integer

      8

      1

      Memory size, in GB.

    1. In the opened sandbox.json file, enter your custom sandbox configuration.

      Example configuration of sandbox.json:

      {
          "filesystem": {
              "readWrite": [
                  "/home/user/project/output",
                  "~/workspace/temp"
              ],
              "readOnly": [
                  "/etc/systemd",
                  "%USERPROFILE%/.ssh"
              ]
          },
          "network": {
              "default": "Allow",
              "deny": [
                  "10.0.0.0/8",
                  "192.168.0.0/16"
              ]
          },
          "resources": {
              "cpu": 50,
              "memory": 4
          }
      }
    1. Save the file for the configuration to take effect.

  6. Configure the network access policy.

    Table 7 Network access policy description

    Parameter

    Description

    Network-wide

    Allows access to all internal and external networks.

    Local

    Only the local network (LAN/intranet) can be accessed. Access to external networks is not allowed.

    This option is unavailable for the Linux sandbox.

    Blocked

    All network connections are blocked, and access to any internal or external network is prohibited.

    In the Linux environment, the Linux sandbox generates an isolated virtual address (127.0.0.1), which is separated from the host machine's localhost. Even when network access is prohibited, this virtual address can still be accessed in the sandbox, and such access will not be blocked by the sandbox.

    Custom

    Allows you to modify the JSON policy configuration file to customize the network access scope for processes within the project sandbox environment. For details about how to configure the JSON file, see 5.

  7. Exit the current setting page. The sandbox mode is enabled.

Execution Policy for High-Risk Commands

When the agent detects a high-risk command, the AI will display a prompt in the chat flow. You need to evaluate risks and select an execution mode as required.

  • Skip: The target command is not executed.
  • Trust XXX: The prefix of the target command is added to the whitelist. Then all commands starting with this prefix will be executed outside the sandbox.
  • Continue running: The target command can be executed outside the sandbox for the current chat.