claude code权限和沙箱

建立使用acceptEdits的权限模式,配合沙箱做好权限管理。

json 复制代码
{
  "permissions": {
    "allow": [
      "Read(/home/ruize/code/simulator/**)",
      "Read(/home/ruize/code/github/**)",
      "Write(/home/ruize/code/simulator/**)",
      "Bash(ls:*)",
      "Bash(cat:*)",
      "Bash(grep:*)",
      "Bash(find:*)",
      "Bash(pwd)",
      "Bash(npm install)",
      "Bash(npm test)",
      "Bash(npm run *)",
      "Bash(git status)",
      "Bash(git diff)",
      "Bash(git log:*)"
    ],
    "deny": [
      "Write(/home/ruize/code/utils/**)",
      "Read(~/.ssh/**)",
      "Read(~/.aws/**)",
      "Read(~/.kube/**)",
      "Read(~/.config/gcloud/**)",
      "Read(~/.npmrc)",
      "Read(**/.env)",
      "Write(**/.env)",
      "Write(.claude/settings.json)",
      "Bash(rm:*)",
      "Bash(sudo:*)",
      "Bash(curl:*)",
      "Bash(wget:*)",
      "Bash(ssh:*)",
      "Bash(scpm:*)"
    ],
    "additionalDirectories": [
      "/home/ruize/code/github"
    ],
    "defaultMode": "acceptEdits"
  },
  "sandbox": {
    "enabled": true,
    "allowUnsandboxedCommands": false,
    "network": {
      "allowedDomains": [
        "registry.npmjs.org",
        "*.npmjs.org",
        "github.com",
        "*.github.com"
      ]
    },
    "filesystem": {
      "allowWrite": [
        "/home/ruize/code/simulator",
        "/tmp"
      ],
      "denyWrite": [
        ".env",
        "**/.env",
        ".claude/settings.json"
      ],
      "denyRead": [
        "~/.ssh",
        "~/.aws",
        "~/.kube",
        "~/.config/gcloud",
        "~/.npmrc",
        ".env",
        "**/.env"
      ],
      "allowRead": [
        "/home/ruize/code/simulator",
        "/home/ruize/code/github"
      ]
    },
    "autoAllowBashIfSandboxed": true
  }
}
相关推荐
枫叶丹48 小时前
开源还是开权重:2026 年 AI 模型战争的控制权之争
人工智能·chatgpt·开源·agent·codex
小猿君1 天前
Claude 入口砍到只剩一个,GPT-6 已经能自己连干 24 小时
人工智能·chatgpt·agi
GEO实战经验分享2 天前
王涛:GEO 服务商能力评估清单——基础、结构、战略、风控四层怎么核验
大数据·人工智能·chatgpt
FEF前端团队2 天前
04# Codex CLI实战:OpenAI的编程代理
前端·chatgpt·ai编程
浩风祭月2 天前
ChatGPT上传PDF后漏读图表?文字版、扫描件和图片要分开处理
人工智能·chatgpt·pdf·提示词·办公效率
星空inn2 天前
DeepSeek V4.1 Flash 实测:分数持平 GPT-6 Astra,单任务成本低 15 倍
ai·chatgpt·deepseek
园长的牧歌2 天前
Ubuntu 24.04 使用ChatGPT 桌面版
chatgpt·codex
Behaviour3 天前
Sam Altman 预热本周重磅产品发布,或为 GPT-6 Sol
人工智能·chatgpt·aigc·openai·vibecoding
星云_byto3 天前
大模型测评:从最新出的DeepSeekV4.1模型看这19项指标
chatgpt·agent·多模态·codex·deepseek·大模型测评·opus-4.8
Caroline5163 天前
GPT Image 2.5 原生透明背景实测:跨境素材流程中抠图环节的替代与边界
chatgpt·gpt image 2.5·跨境素材