damage-control-dev 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- damage_control/__init__.py +9 -0
- damage_control/__main__.py +7 -0
- damage_control/adapter.py +179 -0
- damage_control/audit.py +432 -0
- damage_control/breakglass.py +155 -0
- damage_control/claude_code.py +148 -0
- damage_control/cli.py +173 -0
- damage_control/engine.py +10656 -0
- damage_control/groups.py +114 -0
- damage_control/harness_config.py +205 -0
- damage_control/hook.py +54 -0
- damage_control/install.py +618 -0
- damage_control/packs.py +219 -0
- damage_control/policy.py +323 -0
- damage_control/profile.py +177 -0
- damage_control/rules/aws.json +85 -0
- damage_control/rules/aws.yaml +76 -0
- damage_control/rules/cloud-hosting.json +162 -0
- damage_control/rules/cloud-hosting.yaml +163 -0
- damage_control/rules/containers.json +67 -0
- damage_control/rules/containers.yaml +69 -0
- damage_control/rules/control-plane.json +7 -0
- damage_control/rules/control-plane.yaml +21 -0
- damage_control/rules/core.json +332 -0
- damage_control/rules/core.yaml +441 -0
- damage_control/rules/databases.json +117 -0
- damage_control/rules/databases.yaml +123 -0
- damage_control/rules/firebase.json +34 -0
- damage_control/rules/firebase.yaml +30 -0
- damage_control/rules/gcp.json +60 -0
- damage_control/rules/gcp.yaml +57 -0
- damage_control/rules/git.json +119 -0
- damage_control/rules/git.yaml +120 -0
- damage_control/rules/infrastructure.json +69 -0
- damage_control/rules/infrastructure.yaml +66 -0
- damage_control/rules/mcp-tools.json +11 -0
- damage_control/rules/mcp-tools.yaml +47 -0
- damage_control/rules/outbound.json +40 -0
- damage_control/rules/outbound.yaml +58 -0
- damage_control/rules/payloads.json +120 -0
- damage_control/rules/payloads.yaml +155 -0
- damage_control/rules/publish.json +46 -0
- damage_control/rules/publish.yaml +46 -0
- damage_control/rules/registry.json +10 -0
- damage_control/rules/registry.yaml +11 -0
- damage_control/rules/remote.json +31 -0
- damage_control/rules/remote.yaml +53 -0
- damage_control/rules/tmux.json +17 -0
- damage_control/rules/tmux.yaml +16 -0
- damage_control/ruleset.py +94 -0
- damage_control/tooldefs/aws.json +140 -0
- damage_control/tooldefs/aws.yaml +119 -0
- damage_control/tooldefs/docker.json +146 -0
- damage_control/tooldefs/docker.yaml +123 -0
- damage_control/tooldefs/gcp.json +186 -0
- damage_control/tooldefs/gcp.yaml +158 -0
- damage_control/tooldefs/gh.json +172 -0
- damage_control/tooldefs/gh.yaml +145 -0
- damage_control/tooldefs/git.json +166 -0
- damage_control/tooldefs/git.yaml +143 -0
- damage_control/tooldefs/kubectl.json +101 -0
- damage_control/tooldefs/kubectl.yaml +85 -0
- damage_control/tooldefs/npm.json +77 -0
- damage_control/tooldefs/npm.yaml +65 -0
- damage_control/tooldefs/terraform.json +68 -0
- damage_control/tooldefs/terraform.yaml +57 -0
- damage_control/tooldefs/uv.json +112 -0
- damage_control/tooldefs/uv.yaml +97 -0
- damage_control_dev-0.1.0.dist-info/METADATA +15 -0
- damage_control_dev-0.1.0.dist-info/RECORD +74 -0
- damage_control_dev-0.1.0.dist-info/WHEEL +4 -0
- damage_control_dev-0.1.0.dist-info/entry_points.txt +2 -0
- damage_control_dev-0.1.0.dist-info/licenses/LICENSE +201 -0
- damage_control_dev-0.1.0.dist-info/licenses/NOTICE +4 -0
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
# Core damage control rules
|
|
2
|
+
# File system ops, path protections, process ops, history
|
|
3
|
+
|
|
4
|
+
bashToolPatterns:
|
|
5
|
+
# ---------------------------------------------------------------------------
|
|
6
|
+
# DESTRUCTIVE FILE OPERATIONS
|
|
7
|
+
# ---------------------------------------------------------------------------
|
|
8
|
+
# {ARGS} (#1125): the flag may follow any operand (`rm foo -rf x`), up to `--`.
|
|
9
|
+
- id: core.rm-with-recursive-or-force-flags
|
|
10
|
+
pattern: '\brm\s+(?:(?!--(?:\s|$))[^\s;&|]+\s+)*?-(?!-)[a-z]*[rf][a-z]*(?=[\s;&|)`]|$)'
|
|
11
|
+
pattern_src: '\brm\s+{ARGS}-(?!-)[a-z]*[rf][a-z]*(?=[\s;&|)`]|$)'
|
|
12
|
+
reason: rm with recursive or force flags
|
|
13
|
+
anchored: true
|
|
14
|
+
|
|
15
|
+
- id: core.rm-with-recursive-flag
|
|
16
|
+
pattern: '\brm\s+(?:(?!--(?:\s|$))[^\s;&|]+\s+)*?--recursive'
|
|
17
|
+
pattern_src: '\brm\s+{ARGS}--recursive'
|
|
18
|
+
reason: rm with --recursive flag
|
|
19
|
+
anchored: true
|
|
20
|
+
|
|
21
|
+
- id: core.rm-with-force-flag
|
|
22
|
+
pattern: '\brm\s+(?:(?!--(?:\s|$))[^\s;&|]+\s+)*?--force'
|
|
23
|
+
pattern_src: '\brm\s+{ARGS}--force'
|
|
24
|
+
reason: rm with --force flag
|
|
25
|
+
anchored: true
|
|
26
|
+
|
|
27
|
+
- id: core.sudo-rm
|
|
28
|
+
pattern: '\bsudo\s+rm\b'
|
|
29
|
+
reason: sudo rm
|
|
30
|
+
anchored: true
|
|
31
|
+
|
|
32
|
+
- id: core.rmdir-use-git-clean-or-manual-cleanup
|
|
33
|
+
pattern: '\brmdir\b'
|
|
34
|
+
reason: rmdir (use git clean or manual cleanup)
|
|
35
|
+
bypassable: true
|
|
36
|
+
anchored: true
|
|
37
|
+
|
|
38
|
+
- id: core.rm-file-deletion-use-git-clean-or-manual-cleanup
|
|
39
|
+
pattern: '\brm\s+[^-]'
|
|
40
|
+
reason: rm file deletion (use git clean or manual cleanup)
|
|
41
|
+
bypassable: true
|
|
42
|
+
anchored: true
|
|
43
|
+
|
|
44
|
+
- id: core.trash-command-moves-files-to-trash-use-git-clean-or-manual-c
|
|
45
|
+
pattern: '(?:^|[;&|])\s*trash\s+'
|
|
46
|
+
reason: trash command (moves files to trash - use git clean or manual cleanup)
|
|
47
|
+
bypassable: true
|
|
48
|
+
anchored: true
|
|
49
|
+
|
|
50
|
+
# Non-``rm`` deletion paths that the literal-``rm`` rules miss.
|
|
51
|
+
- id: core.find-delete-recursive-deletion-use-git-clean-or-manual-clean
|
|
52
|
+
pattern: '\bfind\b.*\s-delete\b'
|
|
53
|
+
reason: find -delete (recursive deletion - use git clean or manual cleanup)
|
|
54
|
+
bypassable: true
|
|
55
|
+
anchored: true
|
|
56
|
+
|
|
57
|
+
- id: core.find-exec-chmod-777-world-writable
|
|
58
|
+
pattern: '\bfind\b.*-(?:exec|execdir|ok|okdir)\s+(?:\S*/)?chmod\s+(?:-[^\s;&|]*\s+)*(?:--\s+)?0?777\b'
|
|
59
|
+
reason: find -exec chmod 777 (world writable)
|
|
60
|
+
anchored: true
|
|
61
|
+
|
|
62
|
+
- id: core.find-exec-rm-deletion-via-find-use-git-clean-or-manual-clean
|
|
63
|
+
pattern: '\bfind\b.*-exec\s+rm\b'
|
|
64
|
+
reason: find -exec rm (deletion via find - use git clean or manual cleanup)
|
|
65
|
+
bypassable: true
|
|
66
|
+
anchored: true
|
|
67
|
+
|
|
68
|
+
# ---------------------------------------------------------------------------
|
|
69
|
+
# PERMISSION CHANGES
|
|
70
|
+
# ---------------------------------------------------------------------------
|
|
71
|
+
# The mode is the first non-flag operand: in `chmod u+x 777` the 777 is a
|
|
72
|
+
# FILE (#1133). Only option tokens (`-R`, `-v`, `--reference=…`) may precede it.
|
|
73
|
+
- id: core.chmod-777-world-writable
|
|
74
|
+
pattern: '\bchmod\s+(?:-[^\s;&|]*\s+)*(?:--\s+)?0?777\b'
|
|
75
|
+
reason: chmod 777 (world writable)
|
|
76
|
+
anchored: true
|
|
77
|
+
|
|
78
|
+
# Recursive stays wide on purpose: with `-R`, an unreadable mode token
|
|
79
|
+
# (`chmod -R ${m:-x} 777 /`) must not hide a world-writable tree, so 777
|
|
80
|
+
# ANYWHERE refuses. Price: `chmod -R u+x 777` (a file named 777) still blocks.
|
|
81
|
+
- id: core.recursive-chmod-777
|
|
82
|
+
pattern: '\bchmod\s+(?:(?!--(?:\s|$))[^\s;&|]+\s+)*?(?:-(?!-)[a-z]*r[a-z]*|--recursive)(?=[\s;&|)`]|$).*777'
|
|
83
|
+
pattern_src: '\bchmod\s+{ARGS}(?:-(?!-)[a-z]*r[a-z]*|--recursive)(?=[\s;&|)`]|$).*777'
|
|
84
|
+
reason: recursive chmod 777
|
|
85
|
+
anchored: true
|
|
86
|
+
|
|
87
|
+
- id: core.recursive-chown-to-root
|
|
88
|
+
pattern: '\bchown\s+(?=[^;&|]*\broot\b)(?:(?!--(?:\s|$))[^\s;&|]+\s+)*?(?:-(?!-)[a-z]*r[a-z]*|--recursive)(?=[\s;&|)`]|$)'
|
|
89
|
+
pattern_src: '\bchown\s+(?=[^;&|]*\broot\b){ARGS}(?:-(?!-)[a-z]*r[a-z]*|--recursive)(?=[\s;&|)`]|$)'
|
|
90
|
+
reason: recursive chown to root
|
|
91
|
+
anchored: true
|
|
92
|
+
|
|
93
|
+
# ---------------------------------------------------------------------------
|
|
94
|
+
# SYSTEM-LEVEL DESTRUCTION
|
|
95
|
+
# ---------------------------------------------------------------------------
|
|
96
|
+
- id: core.filesystem-format-command
|
|
97
|
+
pattern: '\bmkfs\.'
|
|
98
|
+
reason: filesystem format command
|
|
99
|
+
anchored: true
|
|
100
|
+
|
|
101
|
+
- id: core.dd-writing-to-device
|
|
102
|
+
pattern: '\bdd\s+.*of=/dev/'
|
|
103
|
+
reason: dd writing to device
|
|
104
|
+
anchored: true
|
|
105
|
+
|
|
106
|
+
# ---------------------------------------------------------------------------
|
|
107
|
+
# PROCESS DESTRUCTION
|
|
108
|
+
# ---------------------------------------------------------------------------
|
|
109
|
+
# `-1` is the all-processes TARGET (pid -1), not SIGHUP, whenever a signal
|
|
110
|
+
# option accompanies it, in either order (`kill -1 -9`, `kill -s KILL -1`,
|
|
111
|
+
# `kill -TERM -- -1`). `kill -1 123` (HUP to one pid) stays allowed (#1133).
|
|
112
|
+
# `-1` anywhere but the FIRST operand is a pid: bash parses options only up
|
|
113
|
+
# front, so `kill --signal TERM -1`, `kill -s KILL 1 -1`, `kill 123 -1` all
|
|
114
|
+
# signal every process. (As the first operand it is SIGHUP: `kill -1 123`.)
|
|
115
|
+
- id: core.kill-all-processes
|
|
116
|
+
pattern: '\bkill\s+(?:[^\s;&|]+\s+)+-1(?=[\s;&|)`]|$)'
|
|
117
|
+
reason: kill all processes
|
|
118
|
+
anchored: true
|
|
119
|
+
|
|
120
|
+
# `kill -1 -9`: -1 first, then another option.
|
|
121
|
+
- id: core.kill-all-processes-2
|
|
122
|
+
pattern: '\bkill\s+-1(?=\s)[^;&|]*?\s-[A-Za-z0-9]'
|
|
123
|
+
reason: kill all processes
|
|
124
|
+
anchored: true
|
|
125
|
+
|
|
126
|
+
# SIGKILL cannot be handled or cleaned up after; rephrase to a plain `kill`
|
|
127
|
+
# (SIGTERM) first. Ask, not block: it is a legitimate last resort.
|
|
128
|
+
- id: core.kill-sigkill
|
|
129
|
+
pattern: '\bkill\s+(?:(?!--(?:\s|$))[^\s;&|]+\s+)*?(?:-(?:9|KILL|SIGKILL)|-s\s*(?:9|KILL|SIGKILL)|-n\s+9|--signal[=\s]\s*(?:9|KILL|SIGKILL))(?=[\s;&|)`]|$)'
|
|
130
|
+
pattern_src: '\bkill\s+{ARGS}(?:-(?:9|KILL|SIGKILL)|-s\s*(?:9|KILL|SIGKILL)|-n\s+9|--signal[=\s]\s*(?:9|KILL|SIGKILL))(?=[\s;&|)`]|$)'
|
|
131
|
+
reason: kill -9 (SIGKILL, no cleanup; use a plain kill first)
|
|
132
|
+
ask: true
|
|
133
|
+
anchored: true
|
|
134
|
+
|
|
135
|
+
# Deferred execution: the crontab body runs later, unobserved, and a file or
|
|
136
|
+
# stdin payload is unreadable here. Only listing (`-l`, `-lu me`, `--list`) and `-V` are read-only.
|
|
137
|
+
- id: core.crontab-install
|
|
138
|
+
pattern: '(?<![\w.-])(?<!\./)crontab(?=[\s;&|)`]|$)(?![^;&|]*\s(?:-[A-Za-z]*l[A-Za-z]*|--list|-V|--version)(?=[\s;&|)`]|$))'
|
|
139
|
+
reason: crontab installs or edits scheduled commands
|
|
140
|
+
ask: true
|
|
141
|
+
anchored: true
|
|
142
|
+
|
|
143
|
+
# `--delete*` removes destination files; `--remove-source-files` removes the
|
|
144
|
+
# SOURCE after transfer. `--no-delete` and `--max-delete` do not match.
|
|
145
|
+
- id: core.rsync-delete
|
|
146
|
+
pattern: '\brsync\s+(?:(?!--(?:\s|$))[^\s;&|]+\s+)*?--(?:del|delete[a-z-]*|remove-(?:source|sent)-files)(?=[\s=;&|)`]|$)'
|
|
147
|
+
pattern_src: '\brsync\s+{ARGS}--(?:del|delete[a-z-]*|remove-(?:source|sent)-files)(?=[\s=;&|)`]|$)'
|
|
148
|
+
reason: rsync deletes files (--delete*, --remove-source-files)
|
|
149
|
+
ask: true
|
|
150
|
+
anchored: true
|
|
151
|
+
|
|
152
|
+
- id: core.killall-9
|
|
153
|
+
pattern: '\bkillall\s+(?:(?!--(?:\s|$))[^\s;&|]+\s+)*?-9\b'
|
|
154
|
+
pattern_src: '\bkillall\s+{ARGS}-9\b'
|
|
155
|
+
reason: killall -9
|
|
156
|
+
anchored: true
|
|
157
|
+
|
|
158
|
+
- id: core.pkill-9
|
|
159
|
+
pattern: '\bpkill\s+(?:(?!--(?:\s|$))[^\s;&|]+\s+)*?-9\b'
|
|
160
|
+
pattern_src: '\bpkill\s+{ARGS}-9\b'
|
|
161
|
+
reason: pkill -9
|
|
162
|
+
anchored: true
|
|
163
|
+
|
|
164
|
+
# ---------------------------------------------------------------------------
|
|
165
|
+
# HISTORY/SHELL MANIPULATION
|
|
166
|
+
# ---------------------------------------------------------------------------
|
|
167
|
+
- id: core.clearing-shell-history
|
|
168
|
+
pattern: '\bhistory\s+-c\b'
|
|
169
|
+
reason: clearing shell history
|
|
170
|
+
anchored: true
|
|
171
|
+
|
|
172
|
+
# ---------------------------------------------------------------------------
|
|
173
|
+
# ZERO ACCESS PATHS - No read, write, or any access allowed
|
|
174
|
+
#
|
|
175
|
+
# Enforced across shell (Bash hook), file edits/writes (Edit/Write hooks) AND
|
|
176
|
+
# native content reads (Read/Grep/Glob hook → check_read_path). Template files
|
|
177
|
+
# (.env.example/.sample/.template/.dist) are carved out as secret-free.
|
|
178
|
+
# ---------------------------------------------------------------------------
|
|
179
|
+
zeroAccessPaths:
|
|
180
|
+
# ---------------------------------------------------------------------------
|
|
181
|
+
# ENVIRONMENT FILES (HIGH RISK - contain secrets)
|
|
182
|
+
# ---------------------------------------------------------------------------
|
|
183
|
+
- ".env"
|
|
184
|
+
- ".env.*"
|
|
185
|
+
- ".env*.local"
|
|
186
|
+
- "*.env"
|
|
187
|
+
|
|
188
|
+
# ---------------------------------------------------------------------------
|
|
189
|
+
# SSH KEYS AND CONFIG
|
|
190
|
+
# ---------------------------------------------------------------------------
|
|
191
|
+
- "~/.ssh/"
|
|
192
|
+
|
|
193
|
+
# ---------------------------------------------------------------------------
|
|
194
|
+
# GPG KEYS
|
|
195
|
+
# ---------------------------------------------------------------------------
|
|
196
|
+
- "~/.gnupg/"
|
|
197
|
+
|
|
198
|
+
# ---------------------------------------------------------------------------
|
|
199
|
+
# CLOUD PROVIDER CREDENTIALS
|
|
200
|
+
# ---------------------------------------------------------------------------
|
|
201
|
+
# AWS
|
|
202
|
+
- "~/.aws/"
|
|
203
|
+
|
|
204
|
+
# GCP
|
|
205
|
+
- "~/.config/gcloud/"
|
|
206
|
+
- "*-credentials.json"
|
|
207
|
+
- "*serviceAccount*.json"
|
|
208
|
+
- "*service-account*.json"
|
|
209
|
+
|
|
210
|
+
# Azure
|
|
211
|
+
- "~/.azure/"
|
|
212
|
+
|
|
213
|
+
# Kubernetes
|
|
214
|
+
- "~/.kube/"
|
|
215
|
+
- "kubeconfig"
|
|
216
|
+
- "*-secret.yaml"
|
|
217
|
+
- "secrets.yaml"
|
|
218
|
+
|
|
219
|
+
# Docker
|
|
220
|
+
- "~/.docker/"
|
|
221
|
+
|
|
222
|
+
# ---------------------------------------------------------------------------
|
|
223
|
+
# SSL/TLS CERTIFICATES AND PRIVATE KEYS
|
|
224
|
+
# ---------------------------------------------------------------------------
|
|
225
|
+
- "*.pem"
|
|
226
|
+
- "*.key"
|
|
227
|
+
- "*.p12"
|
|
228
|
+
- "*.pfx"
|
|
229
|
+
|
|
230
|
+
# ---------------------------------------------------------------------------
|
|
231
|
+
# TERRAFORM STATE (contains secrets in plaintext!)
|
|
232
|
+
# ---------------------------------------------------------------------------
|
|
233
|
+
- "*.tfstate"
|
|
234
|
+
- "*.tfstate.backup"
|
|
235
|
+
- ".terraform/"
|
|
236
|
+
|
|
237
|
+
# ---------------------------------------------------------------------------
|
|
238
|
+
# PLATFORM TOKENS (Vercel, Netlify, etc.)
|
|
239
|
+
# ---------------------------------------------------------------------------
|
|
240
|
+
- ".vercel/"
|
|
241
|
+
- ".netlify/"
|
|
242
|
+
|
|
243
|
+
# ---------------------------------------------------------------------------
|
|
244
|
+
# FIREBASE/SUPABASE
|
|
245
|
+
# ---------------------------------------------------------------------------
|
|
246
|
+
- "firebase-adminsdk*.json"
|
|
247
|
+
- "serviceAccountKey.json"
|
|
248
|
+
- ".supabase/"
|
|
249
|
+
|
|
250
|
+
# ---------------------------------------------------------------------------
|
|
251
|
+
# PACKAGE MANAGER AUTH & CREDENTIALS
|
|
252
|
+
# ---------------------------------------------------------------------------
|
|
253
|
+
- "~/.netrc"
|
|
254
|
+
- "~/.npmrc"
|
|
255
|
+
- "~/.pypirc"
|
|
256
|
+
- "~/.git-credentials"
|
|
257
|
+
- ".git-credentials"
|
|
258
|
+
|
|
259
|
+
# ---------------------------------------------------------------------------
|
|
260
|
+
# DATABASE DUMPS (may contain production data)
|
|
261
|
+
# ---------------------------------------------------------------------------
|
|
262
|
+
- "dump.sql"
|
|
263
|
+
- "backup.sql"
|
|
264
|
+
- "*.dump"
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
# ---------------------------------------------------------------------------
|
|
268
|
+
# READ-ONLY PATHS - Can read, but not write/edit/delete
|
|
269
|
+
# ---------------------------------------------------------------------------
|
|
270
|
+
readOnlyPaths:
|
|
271
|
+
# ---------------------------------------------------------------------------
|
|
272
|
+
# SYSTEM DIRECTORIES
|
|
273
|
+
# ---------------------------------------------------------------------------
|
|
274
|
+
- /etc/
|
|
275
|
+
- /usr/
|
|
276
|
+
- /bin/
|
|
277
|
+
- /sbin/
|
|
278
|
+
- /boot/
|
|
279
|
+
- /root/
|
|
280
|
+
|
|
281
|
+
# ---------------------------------------------------------------------------
|
|
282
|
+
# SHELL HISTORY FILES
|
|
283
|
+
# ---------------------------------------------------------------------------
|
|
284
|
+
- ~/.bash_history
|
|
285
|
+
- ~/.zsh_history
|
|
286
|
+
- ~/.node_repl_history
|
|
287
|
+
|
|
288
|
+
# ---------------------------------------------------------------------------
|
|
289
|
+
# SHELL CONFIG FILES
|
|
290
|
+
# ---------------------------------------------------------------------------
|
|
291
|
+
- ~/.bashrc
|
|
292
|
+
- ~/.zshrc
|
|
293
|
+
- ~/.profile
|
|
294
|
+
- ~/.bash_profile
|
|
295
|
+
|
|
296
|
+
# ---------------------------------------------------------------------------
|
|
297
|
+
# LOCK FILES - Never manually edit, use package managers
|
|
298
|
+
# ---------------------------------------------------------------------------
|
|
299
|
+
- "package-lock.json"
|
|
300
|
+
- "yarn.lock"
|
|
301
|
+
- "pnpm-lock.yaml"
|
|
302
|
+
- "Gemfile.lock"
|
|
303
|
+
- "poetry.lock"
|
|
304
|
+
- "Pipfile.lock"
|
|
305
|
+
- "composer.lock"
|
|
306
|
+
- "Cargo.lock"
|
|
307
|
+
- "go.sum"
|
|
308
|
+
- "flake.lock"
|
|
309
|
+
- "bun.lockb"
|
|
310
|
+
- "uv.lock"
|
|
311
|
+
- "npm-shrinkwrap.json"
|
|
312
|
+
- "*.lock"
|
|
313
|
+
- "*.lockb"
|
|
314
|
+
|
|
315
|
+
# ---------------------------------------------------------------------------
|
|
316
|
+
# MINIFIED/COMPILED FILES - Generated, don't edit
|
|
317
|
+
# ---------------------------------------------------------------------------
|
|
318
|
+
- "*.min.js"
|
|
319
|
+
- "*.min.css"
|
|
320
|
+
- "*.bundle.js"
|
|
321
|
+
- "*.chunk.js"
|
|
322
|
+
|
|
323
|
+
# ---------------------------------------------------------------------------
|
|
324
|
+
# BUILD ARTIFACTS - Generated directories, don't edit
|
|
325
|
+
# ---------------------------------------------------------------------------
|
|
326
|
+
- dist/
|
|
327
|
+
- build/
|
|
328
|
+
- out/
|
|
329
|
+
- .next/
|
|
330
|
+
- .nuxt/
|
|
331
|
+
- .output/
|
|
332
|
+
- node_modules/
|
|
333
|
+
- __pycache__/
|
|
334
|
+
- .venv/
|
|
335
|
+
- venv/
|
|
336
|
+
- target/
|
|
337
|
+
|
|
338
|
+
# ---------------------------------------------------------------------------
|
|
339
|
+
# NO-DELETE PATHS - Can read/write/edit, but not delete
|
|
340
|
+
# ---------------------------------------------------------------------------
|
|
341
|
+
noDeletePaths:
|
|
342
|
+
# ---------------------------------------------------------------------------
|
|
343
|
+
# CLAUDE CODE CONFIGURATION
|
|
344
|
+
# ---------------------------------------------------------------------------
|
|
345
|
+
- ~/.claude/
|
|
346
|
+
- CLAUDE.md
|
|
347
|
+
|
|
348
|
+
# ---------------------------------------------------------------------------
|
|
349
|
+
# LICENSE AND LEGAL FILES
|
|
350
|
+
# ---------------------------------------------------------------------------
|
|
351
|
+
- "LICENSE"
|
|
352
|
+
- "LICENSE.*"
|
|
353
|
+
- "COPYING"
|
|
354
|
+
- "COPYING.*"
|
|
355
|
+
- "NOTICE"
|
|
356
|
+
- "PATENTS"
|
|
357
|
+
|
|
358
|
+
# ---------------------------------------------------------------------------
|
|
359
|
+
# PROJECT DOCUMENTATION
|
|
360
|
+
# ---------------------------------------------------------------------------
|
|
361
|
+
- "README.md"
|
|
362
|
+
- "README.*"
|
|
363
|
+
- "CONTRIBUTING.md"
|
|
364
|
+
- "CHANGELOG.md"
|
|
365
|
+
- "CODE_OF_CONDUCT.md"
|
|
366
|
+
- "SECURITY.md"
|
|
367
|
+
|
|
368
|
+
# ---------------------------------------------------------------------------
|
|
369
|
+
# GIT DIRECTORY
|
|
370
|
+
# ---------------------------------------------------------------------------
|
|
371
|
+
- .git/
|
|
372
|
+
- .gitignore
|
|
373
|
+
- .gitattributes
|
|
374
|
+
- .gitmodules
|
|
375
|
+
|
|
376
|
+
# ---------------------------------------------------------------------------
|
|
377
|
+
# CI/CD CONFIGURATION
|
|
378
|
+
# ---------------------------------------------------------------------------
|
|
379
|
+
- .github/
|
|
380
|
+
- .gitlab-ci.yml
|
|
381
|
+
- .circleci/
|
|
382
|
+
- Jenkinsfile
|
|
383
|
+
- .travis.yml
|
|
384
|
+
- azure-pipelines.yml
|
|
385
|
+
|
|
386
|
+
# ---------------------------------------------------------------------------
|
|
387
|
+
# DOCKER CONFIGURATION
|
|
388
|
+
# ---------------------------------------------------------------------------
|
|
389
|
+
- Dockerfile
|
|
390
|
+
- "Dockerfile.*"
|
|
391
|
+
- docker-compose.yml
|
|
392
|
+
- "docker-compose.*.yml"
|
|
393
|
+
- .dockerignore
|
|
394
|
+
|
|
395
|
+
# ---------------------------------------------------------------------------
|
|
396
|
+
# ALLOWED PATHS - Granular bypass for path-based protections
|
|
397
|
+
# ---------------------------------------------------------------------------
|
|
398
|
+
allowedPaths:
|
|
399
|
+
# ---------------------------------------------------------------------------
|
|
400
|
+
# BUILD ARTIFACTS - Safe to delete/modify (regenerated by build tools)
|
|
401
|
+
# ---------------------------------------------------------------------------
|
|
402
|
+
- path: "*/dist/*"
|
|
403
|
+
allow: all
|
|
404
|
+
- path: "*/build/*"
|
|
405
|
+
allow: all
|
|
406
|
+
- path: "*/out/*"
|
|
407
|
+
allow: all
|
|
408
|
+
- path: "*/.next/*"
|
|
409
|
+
allow: all
|
|
410
|
+
- path: "*/.nuxt/*"
|
|
411
|
+
allow: all
|
|
412
|
+
- path: "*/.output/*"
|
|
413
|
+
allow: all
|
|
414
|
+
|
|
415
|
+
# ---------------------------------------------------------------------------
|
|
416
|
+
# PYTHON CACHES - Safe to delete/modify
|
|
417
|
+
# ---------------------------------------------------------------------------
|
|
418
|
+
- path: "*/__pycache__/*"
|
|
419
|
+
allow: all
|
|
420
|
+
- path: "*/.eggs/*"
|
|
421
|
+
allow: all
|
|
422
|
+
- path: "*.egg-info/*"
|
|
423
|
+
allow: all
|
|
424
|
+
- path: "*/.pytest_cache/*"
|
|
425
|
+
allow: all
|
|
426
|
+
- path: "*/.mypy_cache/*"
|
|
427
|
+
allow: all
|
|
428
|
+
- path: "*/.ruff_cache/*"
|
|
429
|
+
allow: all
|
|
430
|
+
|
|
431
|
+
# ---------------------------------------------------------------------------
|
|
432
|
+
# TEMP DIRECTORIES - Safe to delete/modify
|
|
433
|
+
# ---------------------------------------------------------------------------
|
|
434
|
+
- path: "/tmp/*"
|
|
435
|
+
allow: all
|
|
436
|
+
- path: "/var/tmp/*"
|
|
437
|
+
allow: all
|
|
438
|
+
|
|
439
|
+
# ---------------------------------------------------------------------------
|
|
440
|
+
# PROJECT-SPECIFIC ENV FILES - Needed for tokens/config (read/write/edit only)
|
|
441
|
+
# ---------------------------------------------------------------------------
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bashToolPatterns": [
|
|
3
|
+
{
|
|
4
|
+
"id": "databases.redis-cli-flushall-wipes-all-data",
|
|
5
|
+
"pattern": "\\bredis-cli\\s+FLUSHALL",
|
|
6
|
+
"reason": "redis-cli FLUSHALL (wipes ALL data)",
|
|
7
|
+
"anchored": true
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "databases.redis-cli-flushdb-wipes-database",
|
|
11
|
+
"pattern": "\\bredis-cli\\s+FLUSHDB",
|
|
12
|
+
"reason": "redis-cli FLUSHDB (wipes database)",
|
|
13
|
+
"anchored": true
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"id": "databases.postgresql-dropdb",
|
|
17
|
+
"pattern": "\\bdropdb\\b",
|
|
18
|
+
"reason": "PostgreSQL dropdb",
|
|
19
|
+
"anchored": true
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": "databases.mysql-drop-database",
|
|
23
|
+
"pattern": "\\bmysqladmin\\s+drop\\b",
|
|
24
|
+
"reason": "MySQL drop database",
|
|
25
|
+
"anchored": true
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"pattern": "\\bprisma\\s+migrate\\s+reset\\b",
|
|
29
|
+
"reason": "prisma migrate reset (drops the database and re-applies migrations)",
|
|
30
|
+
"id": "db.prisma-reset",
|
|
31
|
+
"anchored": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"pattern": "\\bflyway\\s+clean\\b",
|
|
35
|
+
"reason": "flyway clean (drops all objects in the schema)",
|
|
36
|
+
"id": "db.flyway-clean",
|
|
37
|
+
"anchored": true
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"pattern": "\\bprisma\\s+migrate\\s+(deploy|dev)\\b",
|
|
41
|
+
"reason": "prisma migrate (applies database migrations)",
|
|
42
|
+
"ask": true,
|
|
43
|
+
"id": "db.prisma-migrate",
|
|
44
|
+
"anchored": true
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"pattern": "\\bprisma\\s+db\\s+push\\b",
|
|
48
|
+
"reason": "prisma db push (pushes schema changes to the database)",
|
|
49
|
+
"ask": true,
|
|
50
|
+
"id": "db.prisma-db-push",
|
|
51
|
+
"anchored": true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"pattern": "\\bsupabase\\s+db\\s+push\\b",
|
|
55
|
+
"reason": "supabase db push (applies local migrations to the linked database)",
|
|
56
|
+
"ask": true,
|
|
57
|
+
"id": "db.supabase-db-push",
|
|
58
|
+
"anchored": true
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"pattern": "\\bsupabase\\s+migration\\s+up\\b",
|
|
62
|
+
"reason": "supabase migration up (applies pending migrations)",
|
|
63
|
+
"ask": true,
|
|
64
|
+
"id": "db.supabase-migration-up",
|
|
65
|
+
"anchored": true
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"pattern": "\\balembic\\s+(upgrade|downgrade)\\b",
|
|
69
|
+
"reason": "alembic upgrade/downgrade (applies/reverts SQLAlchemy migrations)",
|
|
70
|
+
"ask": true,
|
|
71
|
+
"id": "db.alembic",
|
|
72
|
+
"anchored": true
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"pattern": "\\bmanage\\.py\\s+migrate\\b",
|
|
76
|
+
"reason": "Django manage.py migrate (applies database migrations)",
|
|
77
|
+
"ask": true,
|
|
78
|
+
"id": "db.django-migrate",
|
|
79
|
+
"anchored": true
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"pattern": "\\b(rails|rake)\\s+db:migrate\\b",
|
|
83
|
+
"reason": "rails db:migrate (applies ActiveRecord migrations)",
|
|
84
|
+
"ask": true,
|
|
85
|
+
"id": "db.rails-migrate",
|
|
86
|
+
"anchored": true
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"pattern": "\\bknex\\s+migrate:(latest|up|down|rollback)\\b",
|
|
90
|
+
"reason": "knex migrate (applies/reverts Knex migrations)",
|
|
91
|
+
"ask": true,
|
|
92
|
+
"id": "db.knex-migrate",
|
|
93
|
+
"anchored": true
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"pattern": "\\bsequelize\\s+db:migrate\\b",
|
|
97
|
+
"reason": "sequelize db:migrate (applies Sequelize migrations)",
|
|
98
|
+
"ask": true,
|
|
99
|
+
"id": "db.sequelize-migrate",
|
|
100
|
+
"anchored": true
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"pattern": "\\bflyway\\s+migrate\\b",
|
|
104
|
+
"reason": "flyway migrate (applies pending migrations)",
|
|
105
|
+
"ask": true,
|
|
106
|
+
"id": "db.flyway-migrate",
|
|
107
|
+
"anchored": true
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"pattern": "\\bliquibase\\s+update\\b",
|
|
111
|
+
"reason": "liquibase update (applies pending changesets)",
|
|
112
|
+
"ask": true,
|
|
113
|
+
"id": "db.liquibase-update",
|
|
114
|
+
"anchored": true
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Database damage control rules
|
|
2
|
+
# Database CLIs and SQL
|
|
3
|
+
|
|
4
|
+
bashToolPatterns:
|
|
5
|
+
# ---------------------------------------------------------------------------
|
|
6
|
+
# DATABASE CLI DESTRUCTIVE OPERATIONS
|
|
7
|
+
# ---------------------------------------------------------------------------
|
|
8
|
+
- id: databases.redis-cli-flushall-wipes-all-data
|
|
9
|
+
pattern: '\bredis-cli\s+FLUSHALL'
|
|
10
|
+
reason: redis-cli FLUSHALL (wipes ALL data)
|
|
11
|
+
anchored: true
|
|
12
|
+
|
|
13
|
+
- id: databases.redis-cli-flushdb-wipes-database
|
|
14
|
+
pattern: '\bredis-cli\s+FLUSHDB'
|
|
15
|
+
reason: redis-cli FLUSHDB (wipes database)
|
|
16
|
+
anchored: true
|
|
17
|
+
|
|
18
|
+
- id: databases.postgresql-dropdb
|
|
19
|
+
pattern: '\bdropdb\b'
|
|
20
|
+
reason: PostgreSQL dropdb
|
|
21
|
+
anchored: true
|
|
22
|
+
|
|
23
|
+
- id: databases.mysql-drop-database
|
|
24
|
+
pattern: '\bmysqladmin\s+drop\b'
|
|
25
|
+
reason: MySQL drop database
|
|
26
|
+
anchored: true
|
|
27
|
+
|
|
28
|
+
# Migration tools that DROP/recreate the schema (data loss) — hard block.
|
|
29
|
+
- pattern: '\bprisma\s+migrate\s+reset\b'
|
|
30
|
+
reason: prisma migrate reset (drops the database and re-applies migrations)
|
|
31
|
+
id: db.prisma-reset
|
|
32
|
+
anchored: true
|
|
33
|
+
|
|
34
|
+
- pattern: '\bflyway\s+clean\b'
|
|
35
|
+
reason: flyway clean (drops all objects in the schema)
|
|
36
|
+
id: db.flyway-clean
|
|
37
|
+
anchored: true
|
|
38
|
+
|
|
39
|
+
# NOTE: the raw SQL statement rules (DROP TABLE / TRUNCATE / DELETE-without-
|
|
40
|
+
# WHERE) and the psql/mysql/mongosh raw-write rules used to live here. They
|
|
41
|
+
# moved to payloads.yaml (#915) — they match text inside a client's quoted
|
|
42
|
+
# payload, which is the shape that cannot be anchored, and this file is
|
|
43
|
+
# uniformly anchored.
|
|
44
|
+
|
|
45
|
+
# ---------------------------------------------------------------------------
|
|
46
|
+
# SCHEMA MIGRATIONS (ask: true — apply DDL/DML to a database)
|
|
47
|
+
# ---------------------------------------------------------------------------
|
|
48
|
+
# A migration mutates a real database and is rarely cleanly reversible. These
|
|
49
|
+
# were previously `allow`-tier, so a scheduled agent could migrate prod
|
|
50
|
+
# silently. Classify them `ask`. The schema-dropping variants (prisma migrate
|
|
51
|
+
# reset, flyway clean) are hard-blocked above. `\b` before each tool name lets
|
|
52
|
+
# the pattern match through `npx`/`python -m`/`bundle exec` prefixes.
|
|
53
|
+
- pattern: '\bprisma\s+migrate\s+(deploy|dev)\b'
|
|
54
|
+
reason: prisma migrate (applies database migrations)
|
|
55
|
+
ask: true
|
|
56
|
+
id: db.prisma-migrate
|
|
57
|
+
anchored: true
|
|
58
|
+
|
|
59
|
+
- pattern: '\bprisma\s+db\s+push\b'
|
|
60
|
+
reason: prisma db push (pushes schema changes to the database)
|
|
61
|
+
ask: true
|
|
62
|
+
id: db.prisma-db-push
|
|
63
|
+
anchored: true
|
|
64
|
+
|
|
65
|
+
- pattern: '\bsupabase\s+db\s+push\b'
|
|
66
|
+
reason: supabase db push (applies local migrations to the linked database)
|
|
67
|
+
ask: true
|
|
68
|
+
id: db.supabase-db-push
|
|
69
|
+
anchored: true
|
|
70
|
+
|
|
71
|
+
- pattern: '\bsupabase\s+migration\s+up\b'
|
|
72
|
+
reason: supabase migration up (applies pending migrations)
|
|
73
|
+
ask: true
|
|
74
|
+
id: db.supabase-migration-up
|
|
75
|
+
anchored: true
|
|
76
|
+
|
|
77
|
+
- pattern: '\balembic\s+(upgrade|downgrade)\b'
|
|
78
|
+
reason: alembic upgrade/downgrade (applies/reverts SQLAlchemy migrations)
|
|
79
|
+
ask: true
|
|
80
|
+
id: db.alembic
|
|
81
|
+
anchored: true
|
|
82
|
+
|
|
83
|
+
- pattern: '\bmanage\.py\s+migrate\b'
|
|
84
|
+
reason: Django manage.py migrate (applies database migrations)
|
|
85
|
+
ask: true
|
|
86
|
+
id: db.django-migrate
|
|
87
|
+
anchored: true
|
|
88
|
+
|
|
89
|
+
- pattern: '\b(rails|rake)\s+db:migrate\b'
|
|
90
|
+
reason: rails db:migrate (applies ActiveRecord migrations)
|
|
91
|
+
ask: true
|
|
92
|
+
id: db.rails-migrate
|
|
93
|
+
anchored: true
|
|
94
|
+
|
|
95
|
+
- pattern: '\bknex\s+migrate:(latest|up|down|rollback)\b'
|
|
96
|
+
reason: knex migrate (applies/reverts Knex migrations)
|
|
97
|
+
ask: true
|
|
98
|
+
id: db.knex-migrate
|
|
99
|
+
anchored: true
|
|
100
|
+
|
|
101
|
+
- pattern: '\bsequelize\s+db:migrate\b'
|
|
102
|
+
reason: sequelize db:migrate (applies Sequelize migrations)
|
|
103
|
+
ask: true
|
|
104
|
+
id: db.sequelize-migrate
|
|
105
|
+
anchored: true
|
|
106
|
+
|
|
107
|
+
- pattern: '\bflyway\s+migrate\b'
|
|
108
|
+
reason: flyway migrate (applies pending migrations)
|
|
109
|
+
ask: true
|
|
110
|
+
id: db.flyway-migrate
|
|
111
|
+
anchored: true
|
|
112
|
+
|
|
113
|
+
- pattern: '\bliquibase\s+update\b'
|
|
114
|
+
reason: liquibase update (applies pending changesets)
|
|
115
|
+
ask: true
|
|
116
|
+
id: db.liquibase-update
|
|
117
|
+
anchored: true
|
|
118
|
+
|
|
119
|
+
# Raw DML/DDL via DB clients (psql/mysql/mongosh write statements) and the
|
|
120
|
+
# catastrophic statement rules both live in payloads.yaml now — see the note
|
|
121
|
+
# above. The residual gap they carry (file-fed scripts: `psql -f`,
|
|
122
|
+
# `mysql < file`, which a regex cannot introspect) is documented there and in
|
|
123
|
+
# the wiki coverage matrix.
|