-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.claude_permissions
More file actions
304 lines (256 loc) · 9.07 KB
/
Copy path.claude_permissions
File metadata and controls
304 lines (256 loc) · 9.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# Claude Code Permissions for AWS Spot Deployer Project
# This file defines allowed commands and operations for the AWS Spot Instance deployment tool.
# It ensures Claude can operate effectively while maintaining security boundaries.
# =============================================================================
# PROJECT DIRECTORY CONSTRAINTS
# =============================================================================
# All operations must be performed within the project directory
# Working directory: /Users/daaronch/code/personal-examples/databricks-with-bacalhau/spot
# Local environment: Uses .venv and local Python/UV installations
# No global system modifications allowed
# =============================================================================
# PYTHON EXECUTION AND PACKAGE MANAGEMENT
# =============================================================================
# UV package manager operations (local environment only)
allow: uv run -s deploy_spot.py *
allow: uv run -s deploy_spot_complete.py *
allow: uv run -s deploy_spot_portable.py *
allow: uv run -s test_smoke.py
allow: uv run -s build_clean.py
allow: uv run -s util/get_available_regions.py *
allow: uv run -s util/get_ubuntu_amis.py *
allow: uv run -s util/update_config_with_regions.py *
allow: uv run -s delete_vpcs.py
# Python execution (local environment)
allow: python deploy_spot.py *
allow: python deploy_spot_complete.py *
allow: python deploy_spot_portable.py *
allow: python test_smoke.py
allow: python build_clean.py
allow: python -m unittest test_smoke
allow: python -m pip install *
# Python virtual environment operations
allow: .venv/bin/python *
allow: source .venv/bin/activate
# =============================================================================
# BINARY EXECUTION AND TESTING
# =============================================================================
# Execute built binaries for testing
allow: ./dist/aws-spot-deployer *
allow: ./dist/aws-spot-deployer-complete *
allow: ./dist/aws-spot-deployer-final *
allow: ./dist/aws-spot-deployer-test *
allow: ./dist/aws-spot-deployer-working *
# Make binaries executable
allow: chmod +x dist/*
allow: chmod 755 dist/*
# =============================================================================
# BUILD SYSTEM AND COMPILATION
# =============================================================================
# PyInstaller operations for binary building
allow: pyinstaller *.spec
allow: pyinstaller aws-spot-deployer.spec
allow: pyinstaller aws-spot-deployer-complete.spec
allow: pyinstaller deploy_spot.py
allow: pyinstaller deploy_spot_complete.py
# Build system dependencies
allow: pip install pyinstaller
allow: python -m pip install pyinstaller
# =============================================================================
# FILE SYSTEM OPERATIONS
# =============================================================================
# File listing and directory operations (local directory only)
allow: ls *
allow: ls -la *
allow: ls -l dist/
allow: ls *.py *.spec
allow: tree
allow: find . -name "*.py"
allow: find . -name "*.spec"
# File operations for development
allow: cp *.py *
allow: cp *.spec *
allow: cp config.yaml_example config.yaml
allow: mv *.py *
allow: mv *.spec *
allow: rm *.py
allow: rm *.spec
allow: rm -f *.py
allow: rm -f *.spec
allow: rm -f debug_deploy_spot.log
allow: rm -f machines.db
# Directory cleanup operations
allow: rm -rf build/
allow: rm -rf dist/
allow: rm -rf __pycache__/
allow: shutil.rmtree("build")
allow: shutil.rmtree("dist")
allow: shutil.rmtree("__pycache__")
# =============================================================================
# DEVELOPMENT AND TESTING TOOLS
# =============================================================================
# Code quality and formatting
allow: ruff check .
allow: ruff format .
allow: black *.py
allow: flake8 *.py
allow: mypy *.py
# Git operations (local repository only)
allow: git status
allow: git add *.py *.spec *.md
allow: git commit -m "*"
allow: git diff
allow: git log --oneline
allow: git branch
allow: git checkout *
# =============================================================================
# CONFIGURATION AND DATA FILES
# =============================================================================
# Configuration file operations
allow: cat config.yaml*
allow: cat *.json
allow: cat *.csv
allow: cat debug_deploy_spot.log
allow: head -n * *.log
allow: tail -n * *.log
# JSON and CSV data operations
allow: jq . *.json
allow: python -m json.tool *.json
# =============================================================================
# AWS AND CLOUD OPERATIONS (LOCAL ENVIRONMENT ONLY)
# =============================================================================
# AWS CLI operations (using local AWS config)
allow: aws configure list
allow: aws sts get-caller-identity
allow: aws ec2 describe-regions
allow: aws ec2 describe-instances
allow: aws configure set *
# Environment variable operations (local scope)
allow: export AWS_PROFILE=*
allow: export AWS_REGION=*
allow: export PYTHONPATH=*
allow: env | grep AWS
allow: env | grep PYTHON
# =============================================================================
# SYSTEM INFORMATION (READ-ONLY)
# =============================================================================
# System information for debugging
allow: which python
allow: which python3
allow: which uv
allow: which pyinstaller
allow: which aws
allow: python --version
allow: uv --version
allow: aws --version
# Process and resource monitoring
allow: ps aux | grep python
allow: ps aux | grep aws-spot-deployer
allow: du -sh dist/
allow: wc -l *.py
allow: file dist/*
# =============================================================================
# NETWORKING AND CONNECTIVITY (LOCAL TESTING ONLY)
# =============================================================================
# Local connectivity testing (no external calls)
allow: ping -c 1 127.0.0.1
allow: curl -I http://localhost:*
allow: netstat -an | grep :*
# =============================================================================
# DOCUMENTATION AND HELP
# =============================================================================
# Help and documentation access
allow: man *
allow: help *
allow: python -m pydoc *
allow: python -c "help(*)"
# =============================================================================
# FORBIDDEN OPERATIONS
# =============================================================================
# These operations are explicitly forbidden for security:
deny: rm -rf /
deny: rm -rf ~
deny: rm -rf /*
deny: sudo *
deny: chmod 777 *
deny: chown *
deny: curl http://*
deny: wget http://*
deny: ssh *
deny: scp *
deny: rsync *
deny: docker *
deny: systemctl *
deny: service *
deny: crontab *
deny: pip install --global *
deny: npm install -g *
# Network operations outside local testing
deny: curl https://*
deny: wget https://*
deny: nc *
deny: telnet *
# System configuration changes
deny: /etc/*
deny: /usr/*
deny: /var/*
deny: ~/.bashrc
deny: ~/.zshrc
deny: ~/.profile
# =============================================================================
# ENVIRONMENT CONSTRAINTS
# =============================================================================
# Working directory must remain in project root
working_directory: /Users/daaronch/code/personal-examples/databricks-with-bacalhau/spot
# Python environment constraints
python_env: .venv/bin/python
package_manager: uv
dependency_scope: local
# File operation scope
file_scope: ./
max_file_size: 100MB
allowed_extensions: .py, .spec, .yaml, .yml, .json, .csv, .md, .txt, .log, .sh
# AWS operations scope
aws_config_scope: local
aws_profile_scope: current_user
no_global_aws_changes: true
# =============================================================================
# SPECIAL PERMISSIONS FOR THIS PROJECT
# =============================================================================
# Allow reading project-specific files
allow_read: deploy_spot*.py
allow_read: test_*.py
allow_read: build_*.py
allow_read: *.spec
allow_read: config.yaml*
allow_read: *.md
allow_read: *.json
allow_read: *.csv
allow_read: debug_*.log
# Allow writing to project outputs
allow_write: dist/
allow_write: build/
allow_write: *.log
allow_write: machines.db
allow_write: config.yaml
allow_write: *.json
allow_write: *.csv
# Allow execution of project binaries
allow_execute: dist/aws-spot-deployer*
allow_execute: *.py (local scope only)
# =============================================================================
# USAGE NOTES
# =============================================================================
# This permissions file ensures:
# 1. All operations stay within the project directory
# 2. No global system modifications
# 3. Local Python/UV environment usage
# 4. AWS operations use local configuration only
# 5. Build and test operations are fully enabled
# 6. Security boundaries are maintained
# 7. Development workflow is unimpeded
# To use this file:
# 1. Place in project root as .claude_permissions
# 2. Claude will automatically respect these constraints
# 3. All operations will be scoped to local environment
# 4. No additional permission requests needed for listed operations