Skip to content

Commit 89f331b

Browse files
fix: temporarily disabling the dangerous env and rm , as running in cotnainers
1 parent 9d82e4b commit 89f331b

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

claude-code/hooks/pre_tool_use.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,20 @@ def main():
8989
tool_name = input_data.get('tool_name', '')
9090
tool_input = input_data.get('tool_input', {})
9191

92-
# Check for .env file access (blocks access to sensitive environment files)
93-
if is_env_file_access(tool_name, tool_input):
94-
print("BLOCKED: Access to .env files containing sensitive data is prohibited", file=sys.stderr)
95-
print("Use .env.sample for template files instead", file=sys.stderr)
96-
sys.exit(2) # Exit code 2 blocks tool call and shows error to Claude
92+
# # Check for .env file access (blocks access to sensitive environment files)
93+
# if is_env_file_access(tool_name, tool_input):
94+
# print("BLOCKED: Access to .env files containing sensitive data is prohibited", file=sys.stderr)
95+
# print("Use .env.sample for template files instead", file=sys.stderr)
96+
# sys.exit(2) # Exit code 2 blocks tool call and shows error to Claude
9797

98-
# Check for dangerous rm -rf commands
99-
if tool_name == 'Bash':
100-
command = tool_input.get('command', '')
98+
# # Check for dangerous rm -rf commands
99+
# if tool_name == 'Bash':
100+
# command = tool_input.get('command', '')
101101

102-
# Block rm -rf commands with comprehensive pattern matching
103-
if is_dangerous_rm_command(command):
104-
print("BLOCKED: Dangerous rm command detected and prevented", file=sys.stderr)
105-
sys.exit(2) # Exit code 2 blocks tool call and shows error to Claude
102+
# # Block rm -rf commands with comprehensive pattern matching
103+
# if is_dangerous_rm_command(command):
104+
# print("BLOCKED: Dangerous rm command detected and prevented", file=sys.stderr)
105+
# sys.exit(2) # Exit code 2 blocks tool call and shows error to Claude
106106

107107
# Ensure log directory exists
108108
log_dir = Path.cwd() / 'logs'

0 commit comments

Comments
 (0)