Skip to content

DotCraft Security Configuration

DotCraft security settings control file access, shell execution, web fetching, and sandbox isolation. Put project-specific security policy in workspace config so each project can use the right boundary.

Quick Start

json
{
  "Security": {
    "BlacklistedPaths": [
      "~/.ssh",
      "~/.gnupg",
      "~/.aws"
    ]
  },
  "Tools": {
    "File": {
      "RequireApprovalOutsideWorkspace": true
    },
    "Shell": {
      "RequireApprovalOutsideWorkspace": true,
      "Timeout": 300
    }
  }
}

This blocks sensitive directories and requires approval for file or shell paths outside the workspace.

Configuration

File Access Blacklist

Security.BlacklistedPaths defines paths that DotCraft must not access. The blacklist applies across CLI, Desktop, external channels, and automation entry points.

json
{
  "Security": {
    "BlacklistedPaths": [
      "~/.ssh",
      "/etc/shadow",
      "C:\\Windows\\System32"
    ]
  }
}

Blacklist behavior:

  • ReadFile, WriteFile, EditFile, GrepFiles, and FindFiles are rejected for blacklisted paths.
  • Shell commands that reference blacklisted paths are rejected.
  • Blacklist checks run before workspace boundary checks.
  • Absolute paths and ~ expansion are supported, including child paths.

Workspace Boundary

DotCraft analyzes paths before running shell commands. It covers Unix absolute paths, home-directory paths, environment-variable paths, Windows drive paths, UNC paths, and common safe device paths.

When a referenced path resolves outside the workspace:

  • Tools.Shell.RequireApprovalOutsideWorkspace = false rejects the command.
  • Tools.Shell.RequireApprovalOutsideWorkspace = true asks the current interaction source for approval.

File tools also expand ~, $HOME, ${HOME}, and %ENV% so workspace boundary checks stay consistent.

Tool Security Fields

FieldDescriptionDefault
Tools.File.RequireApprovalOutsideWorkspaceWhether file operations outside the workspace require approvaltrue
Tools.File.MaxFileSizeMaximum readable file size in bytes10485760
Tools.Shell.RequireApprovalOutsideWorkspaceWhether shell commands outside the workspace require approvaltrue
Tools.Shell.TimeoutShell command timeout in seconds300
Tools.Shell.MaxOutputLengthMaximum shell output length in characters10000
Tools.Web.MaxCharsMaximum web fetch characters50000
Tools.Web.TimeoutWeb request timeout in seconds300
Tools.Web.SearchMaxResultsDefault web search result count5
Tools.Web.SearchProviderSearch provider: Bing / ExaExa
Tools.Lsp.EnabledEnables the built-in LSP toolfalse
Tools.Lsp.MaxFileSizeMaximum file size for LSP open/sync10485760

Sandbox Mode

OpenSandbox can run Shell and File tools inside an isolated Docker container.

Prerequisites:

bash
pip install opensandbox-server
opensandbox-server

Example:

json
{
  "Tools": {
    "Sandbox": {
      "Enabled": true,
      "Domain": "localhost:5880",
      "Image": "ubuntu:latest",
      "NetworkPolicy": "allow",
      "SyncWorkspace": true
    }
  }
}
FieldDescriptionDefault
Tools.Sandbox.EnabledEnables sandbox modefalse
Tools.Sandbox.DomainOpenSandbox service addresslocalhost:5880
Tools.Sandbox.ApiKeyOpenSandbox API keyEmpty
Tools.Sandbox.UseHttpsUses HTTPSfalse
Tools.Sandbox.ImageSandbox container imageubuntu:latest
Tools.Sandbox.TimeoutSecondsSandbox timeout in seconds600
Tools.Sandbox.CpuContainer CPU limit1
Tools.Sandbox.MemoryContainer memory limit512Mi
Tools.Sandbox.NetworkPolicyNetwork policy: deny / allow / customallow
Tools.Sandbox.AllowedEgressDomainsCustom allowed egress domains[]
Tools.Sandbox.IdleTimeoutSecondsIdle timeout in seconds300
Tools.Sandbox.SyncWorkspaceSyncs the workspace into the containertrue

Usage Examples

ScenarioRecommendation
Personal local projectKeep outside-workspace approval and blacklist SSH, cloud credentials, and password-manager directories
Shared team workspaceStore security policy in project .craft/config.json so every entry point enforces it
External channel or botRequire outside-workspace approval and limit tools and network access
Automation tasksEnable sandboxing or narrow EnabledTools according to task risk

Troubleshooting

A command inside the workspace is still rejected

Check whether the command string references an outside path such as ~/.ssh, /etc, C:\Users, or an environment variable that expands outside the workspace.

Sandbox does not start

Confirm Docker and opensandbox-server are running, then check Tools.Sandbox.Domain, ApiKey, and network policy.

Web search or fetch fails

Check Tools.Web.SearchProvider, Tools.Web.Timeout, Tools.Web.MaxChars, and the network environment.

Apache License 2.0