Check a repository before you open it
Opening a repository can execute code, so check it before you start Claude Code:
- Read
.claude/settings.json,.claude/settings.local.json,.claude/hooks/,.mcp.jsonandCLAUDE.md, and stop at any hook you didn’t write, especially underSessionStart. - Read
.mcp.jsonbefore accepting the folder-trust prompt, since trusting the folder starts its MCP servers outside the sandbox. - List every symlink and its target: a harmless name pointing at
.claude/,.mcp.jsonor a dotfile is an attack. - Don’t rely on the approval prompt alone, because it can name one file while the write lands on another.
- Stay on Claude Code 2.1.179 or later, with plugin marketplaces on GitHub or infrastructure you control.
Teams can block repository-supplied hooks and MCP servers with allowManagedHooksOnly and allowManagedMcpServersOnly in managed settings (settings reference).