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
  }
}
相关推荐
摸鱼同学2 小时前
09-Agent 设计三阶段:ReAct → Memory → Reflection
ai·chatgpt·agent·ai编程
提示词牛马5 小时前
技术前沿深度洞察报告-第10期
人工智能·chatgpt
摆烂工程师20 小时前
今天 ChatGPT 大规模无差别封号,附上 GPT 官方申诉入口 以及 GPT 聊天记录备份方式
chatgpt·openai·ai编程
码农小旋风1 天前
Codex中文网 | Codex CLI 中文指南
运维·服务器·ide·人工智能·chatgpt·claude
shchojj1 天前
ChatGPT Prompt Engineering for Developers
chatgpt·prompt
启途AI2 天前
当营销话术超越产品实体:GEO市场的诚信挑战
大数据·人工智能·搜索引擎·ai·chatgpt
知识领航员2 天前
30个AI音乐提示词|直接复制可用,覆盖6大风格
人工智能·adobe·chatgpt·prompt·aigc·音视频
0X782 天前
Windows 上 Codex Desktop 的 Chrome 和 Computer Use 插件不可用:一次完整排查与修复
人工智能·chatgpt·ai编程
梓䈑2 天前
C++ AI模型统一接入引擎(第一篇):项目介绍与环境搭建
c++·人工智能·chatgpt