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
  }
}
相关推荐
dozenyaoyida13 小时前
AI与大模型新闻日报 | 2026-10-30
人工智能·ai·chatgpt·大模型·新闻
LaughingZhu14 小时前
Product Hunt 热榜 2026-10-30:Empacer、Scape、Floot in ChatGPT
java·前端·数据库·人工智能·chatgpt·notion
卢卡上学14 小时前
WorkBuddy内配置使用Claude、ChatGPT、Gemini、Grop模型
chatgpt·中转站·腾讯workbuddy
shennv88816 小时前
ChatGPT Plus订阅后如何使用Codex?CLI安装、额度查询与项目开发实践
chatgpt
sg_knight17 小时前
Bug 定位实战:把报错丢给 Codex,它是怎么修的
chatgpt·llm·bug·openai·agent·ai编程·codex
Maynor9961 天前
ChatGPT Pro 额度档位怎么理解:5x / 20x / 50x 使用笔记
ai·chatgpt·教程
玫瑰互动GEO2 天前
GEM优化广告六要素: 从命名一致到落地页双对齐的工程化落地
人工智能·ai·chatgpt·gem优化
shandianchengzi2 天前
【记录】LLM|ChatGPT连接Github并管理
chatgpt·github
承渊政道2 天前
【大模型应用开发:基于GPT-4和ChatGPT】(使用LangChain框架和插件增强LLM的功能)
chatgpt·langchain·llm·框架·大模型应用开发
梦想出海-Phoebe2 天前
ChatGPT 2026年10月更新汇总:GPT-6.1 Terra、AI短信助手与新功能解析
人工智能·chatgpt