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
  }
}
相关推荐
AI工程效率栈10 小时前
AI 帮你补异常处理时,新人最容易犯的错:把失败悄悄变成成功
gpt·chatgpt
凌奕3 天前
让你的 AI 编程助手「偷懒」:50k Star 的 Ponytail,让 Agent 少写一半代码
chatgpt·agent·claude
星落zx9 天前
Spring Boot 多模型集成:优雅调用全球主流大模型
人工智能·spring boot·chatgpt
爱读书的小胖9 天前
无偿分享ChatGPT Image 2画图网页与并发绘图python程序【Ai绘图】
开发语言·python·chatgpt
码农小旋风9 天前
Claude Code 基础用法大全:对话、分析、修改、测试、Git 和工作流
人工智能·git·chatgpt·claude
武子康9 天前
调查研究-180 roboflow/supervision:计算机视觉工程里的“胶水层“,为什么值得关注?
人工智能·opencv·计算机视觉·chatgpt·llm·向量化
果子耶耶9 天前
让大模型帮我写单元测试,5个模型的覆盖率和边界处理能力实测
chatgpt·单元测试
LaughingZhu9 天前
Product Hunt 每日热榜 | 2026-06-16
前端·人工智能·经验分享·chatgpt·html
小宋102110 天前
4 万 Star 的开源 ChatGPT 桌面端:用 Jan 把电脑变成离线 AI 工作站
人工智能·chatgpt·开源·jan
我就是全世界10 天前
具身智能难现“ChatGPT时刻”:缺统一范式,更缺优质数据
人工智能·chatgpt·机器人