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 secret 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 user decision-making.
- 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
| Category | Description |
|---|---|
| OS |
|
| Controlled object |
|
File Access Control
After sandbox is enabled, CodeArts Agent Space configures file directory access permissions as described below. 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 4.
| 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 |
| |
| Sensitive user directories |
| ||
| macOS | Read-only | - | All directories are readable except sensitive system directories. |
| Read/Write | Workspace and additionally configured directories |
| |
| No read/No write | Documents/Desktop/Downloads (privacy-related) |
| |
| Password/Wallet/Keychain-related | ~/Library/Keychains | ||
| System-level sensitive configuration |
| ||
| Linux | Read-only | - | All directories are readable except sensitive system directories. |
| Read/Write | Workspace and additionally configured directories |
| |
| No read/No write | Critical Linux system directories |
|
Enabling Sandbox
- Access CodeArts Agent Space by referring to Enabling CodeArts Agent Space.
- Click
in the upper right corner of CodeArts Agent Space to open the settings page. - Enable the sandbox mode.
- In the navigation pane on the left, choose Chats.
- Under Agents, select Running in Sandbox from the Terminal Command Running Mode drop-down list. Figure 1 Selecting Running in Sandbox
- 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.
- 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": 8 } }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.
- 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 } }
- Save the file for the configuration to take effect.
- 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.
- Configure the command whitelist.
Add prefixes of specific commands to the whitelist as required. Commands added to the whitelist bypass the sandbox mechanism and are executed outside the sandbox.
- Configure the network access policy.
Table 7 Network access policy description Parameter
Description
Network-wide
Allows access to all internal and external network resources.
Local
Only allows access to local networks (LAN/intranet); blocks all external network access.
Blocked
Blocks all network connections and prohibits access to any internal or external resources.
Custom
Allows you to modify the JSON policy configuration file to customize the file and network access scope for processes within the project sandbox environment. For details about how to configure the JSON file, see 4.
- 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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot