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
  }
}
相关推荐
孤狼GPT18 小时前
Codex免费版够用吗?Free、Plus和Pro怎么选
chatgpt·ai编程·codex·chatgpt plus·chatgpt pro
顿哥GPT19 小时前
7月15更新ChatGPT Pro、Plus 与 Codex:多 Agent 软件工程中的一致性问题 (GPT5.6来了)
人工智能·chatgpt·软件工程
yingyuecom20 小时前
映悦AI复刻爆款更新深度评测:资产锁定如何治好AI短剧的‘变脸症’
人工智能·gpt·chatgpt·prompt·aigc
Python大数据分析@21 小时前
如何评价 OpenAI 正式推出的 GPT-5.6 系列模型?
gpt·chatgpt
南方程序猴21 小时前
Codex 国内怎么配置?CC Switch + 中转站接入 GPT-5.6 保姆级教程
人工智能·gpt·ai·chatgpt·ai编程
repokey-Yao21 小时前
AI 如何看懂 FPGA 大工程?RepoKey Starter 使用记录
人工智能·chatgpt·fpga
AI大模型-小雄1 天前
ChatGPT 上传文件失败怎么办?从格式、大小到账号状态逐项排查
gpt·chatgpt·ai编程·开发工具·codex·ai办公·chatgpt pro
Proaiapi1 天前
GPT-5.6 使用指南:从 ChatGPT 到 Codex,AI 开发进入 Agent 时代
人工智能·gpt·chatgpt
AI大模型-小雄2 天前
用 ChatGPT 整理工作资料,正确的提问顺序是什么?附完整操作模板
人工智能·chatgpt·提示词·效率工具·codex·办公技巧·ai办公
福大大架构师每日一题2 天前
ollama v0.32.0发布:交互式智能体正式上线,命令行入口彻底升级,ChatGPT集成更名,旧模型启动前新增弃用警告
chatgpt