kneepad 0.3.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.
@@ -0,0 +1,305 @@
1
+ # Generated by tools/gen_platform_rules.py. Edit the generator, not this file.
2
+
3
+ [[rule]]
4
+ id = "mac-disk-erase"
5
+ title = "diskutil erase, partition, reformat or APFS delete"
6
+ family = "macos"
7
+ severity = "critical"
8
+ action = "deny"
9
+ why = "These diskutil verbs erase or repartition a disk or volume. The data is gone and Time Machine will not help if the target was the backup disk."
10
+ safer = "Run diskutil list and diskutil info on the target first and make sure it is not the boot or backup disk."
11
+ reversible = "no"
12
+ [rule.match]
13
+ cmd = ["diskutil"]
14
+ args_regex = '(?i)^\s*(?:(?:erase\S*|partitiondisk|splitpartition|mergepartitions|reformat|securerase|zerodisk|randomdisk|resizevolume|repartitiondisk|secureerase)\b|apfs\s+(?:delete\S*|erase\S*|resize\S*)|appleraid\s+delete|cs\s+delete)'
15
+ [rule.examples]
16
+ match = ["diskutil eraseDisk APFS Mac disk2", "diskutil eraseVolume HFS+ x /Volumes/x", "diskutil partitionDisk disk3 GPT JHFS+ n 0b", "diskutil secureErase 0 disk2", "diskutil apfs deleteVolume disk1s2", "diskutil apfs deleteContainer disk4", "diskutil zeroDisk disk2"]
17
+ no_match = ["diskutil list", "diskutil info disk0", "diskutil unmount /Volumes/x", "diskutil mount disk2s1"]
18
+
19
+ [[rule]]
20
+ id = "mac-asr-restore"
21
+ title = "asr restore (overwrites a volume from an image)"
22
+ family = "macos"
23
+ severity = "critical"
24
+ action = "deny"
25
+ why = "asr restore overwrites the target volume with an image. A wrong target erases the wrong disk."
26
+ safer = "Check the target with diskutil info and keep a backup."
27
+ reversible = "no"
28
+ [rule.match]
29
+ cmd = ["asr"]
30
+ args_regex = '(?i)(?:^|\s)(?:restore|--erase)\b'
31
+ [rule.examples]
32
+ match = ["asr restore --source a.dmg --target /Volumes/x --erase", "asr restore -s a.dmg -t /Volumes/y"]
33
+ no_match = ["asr imagescan --source a.dmg", "echo asr restore"]
34
+
35
+ [[rule]]
36
+ id = "mac-csrutil"
37
+ title = "csrutil disable (System Integrity Protection)"
38
+ family = "macos"
39
+ severity = "high"
40
+ action = "ask"
41
+ why = "Turning off SIP removes the protection of system files and lets any process modify them."
42
+ safer = "Keep SIP on. If you need to debug something, scope the exception narrowly and re-enable it."
43
+ reversible = "no"
44
+ [rule.match]
45
+ cmd = ["csrutil"]
46
+ args_regex = '(?i)(?:disable|clear|enable\s+--without)'
47
+ [rule.examples]
48
+ match = ["csrutil disable", "csrutil authenticated-root disable", "csrutil clear"]
49
+ no_match = ["csrutil status", "echo csrutil disable"]
50
+
51
+ [[rule]]
52
+ id = "mac-kmutil"
53
+ title = "kmutil load, unload, install or configure-boot (kernel extensions)"
54
+ family = "macos"
55
+ severity = "high"
56
+ action = "ask"
57
+ why = "Loading or unloading kernel extensions and changing boot policy can destabilise or disable security on the Mac."
58
+ safer = "Use kmutil showloaded to inspect, and only install extensions from vendors you trust."
59
+ reversible = "no"
60
+ [rule.match]
61
+ cmd = ["kmutil"]
62
+ args_regex = '(?i)^\s*(?:load|unload|install|create|configure-boot|clear-staging|trigger-panic-stackshot)\b'
63
+ [rule.examples]
64
+ match = ["kmutil load -p /Library/Extensions/x.kext", "kmutil unload -b com.x", "sudo kmutil configure-boot -c x -v /Volumes/y"]
65
+ no_match = ["kmutil showloaded", "kmutil inspect -b com.x"]
66
+
67
+ [[rule]]
68
+ id = "mac-gatekeeper-off"
69
+ title = "turn off Gatekeeper (spctl)"
70
+ family = "macos"
71
+ severity = "high"
72
+ action = "ask"
73
+ why = "Disabling Gatekeeper lets unsigned and unnotarised apps run without a prompt."
74
+ safer = "Open the one app you trust via System Settings, Privacy and Security."
75
+ reversible = "no"
76
+ [rule.match]
77
+ cmd = ["spctl"]
78
+ args_regex = '(?i)(?:--master-disable|--global-disable|--disable\b)'
79
+ [rule.examples]
80
+ match = ["spctl --master-disable", "sudo spctl --global-disable"]
81
+ no_match = ["spctl --status", "spctl --assess -v App.app"]
82
+
83
+ [[rule]]
84
+ id = "mac-xattr-quarantine"
85
+ title = "remove quarantine or all extended attributes (xattr -d com.apple.quarantine, -c)"
86
+ family = "macos"
87
+ severity = "medium"
88
+ action = "ask"
89
+ why = "Removing quarantine skips Gatekeeper checks for that file. xattr -c also strips every other attribute (tags, resource forks, download origin)."
90
+ safer = "Remove the attribute from a single file you downloaded yourself and verified."
91
+ reversible = "no"
92
+ [rule.match]
93
+ cmd = ["xattr"]
94
+ args_regex = '(?i)(?:-\w*d\w*\s+com\.apple\.quarantine|(?:^|\s)-\w*c\w*(?:\s|$))'
95
+ [rule.examples]
96
+ match = ["xattr -d com.apple.quarantine App.app", "xattr -cr /Applications/Foo.app", "xattr -dr com.apple.quarantine ."]
97
+ no_match = ["xattr -l file", "xattr file", "xattr -w user.x y file"]
98
+
99
+ [[rule]]
100
+ id = "mac-timemachine"
101
+ title = "Time Machine delete, disable or thin snapshots (tmutil)"
102
+ family = "macos"
103
+ severity = "high"
104
+ action = "ask"
105
+ why = "These commands delete backups or local snapshots, or turn backups off. They remove your restore points."
106
+ safer = "Run tmutil listbackups and tmutil listlocalsnapshots first and delete one named item."
107
+ reversible = "no"
108
+ [rule.match]
109
+ cmd = ["tmutil"]
110
+ args_regex = '(?i)^\s*(?:delete|deletelocalsnapshots|disable|disablelocal|thinlocalsnapshots|removedestination|restore)\b'
111
+ [rule.examples]
112
+ match = ["tmutil deletelocalsnapshots 2024-01-01-000000", "tmutil delete -d /Volumes/b -t 2024-01-01", "tmutil disable", "tmutil thinlocalsnapshots / 10000000000 4", "tmutil removedestination ABC"]
113
+ no_match = ["tmutil listbackups", "tmutil status", "tmutil startbackup"]
114
+
115
+ [[rule]]
116
+ id = "mac-launchd"
117
+ title = "launchctl bootout, unload, remove, disable or kickstart -k"
118
+ family = "macos"
119
+ severity = "high"
120
+ action = "ask"
121
+ why = "Unloading or disabling launchd jobs can stop system services, security tools and MDM agents. Loading one with -w makes it persistent."
122
+ safer = "Run launchctl print on the label first and change one user agent rather than a system daemon."
123
+ reversible = "no"
124
+ [rule.match]
125
+ cmd = ["launchctl"]
126
+ args_regex = '(?i)(?:^|\s)(?:bootout|unload|remove|disable|kill|kickstart\s+-k|bootstrap\s+system|load\s+-w)\b'
127
+ [rule.examples]
128
+ match = ["launchctl bootout system/com.apple.foo", "sudo launchctl unload /Library/LaunchDaemons/x.plist", "launchctl remove com.x", "launchctl disable gui/501/com.x"]
129
+ no_match = ["launchctl list", "launchctl print system", "launchctl load ~/Library/LaunchAgents/x.plist"]
130
+
131
+ [[rule]]
132
+ id = "mac-defaults-delete"
133
+ title = "defaults delete (removes a preference domain or key)"
134
+ family = "macos"
135
+ severity = "medium"
136
+ action = "ask"
137
+ why = "defaults delete removes saved preferences for an app or for the whole system. Apps may reset or misbehave."
138
+ safer = "Run defaults read first and export the domain: defaults export com.example.app backup.plist."
139
+ reversible = "no"
140
+ [rule.match]
141
+ cmd = ["defaults"]
142
+ args_regex = '(?i)^\s*(?:-currenthost\s+)?(?:delete|remove)\b'
143
+ [rule.examples]
144
+ match = ["defaults delete com.apple.dock", "defaults delete -g AppleLanguages", "defaults -currentHost delete com.apple.x"]
145
+ no_match = ["defaults read com.apple.dock", "defaults write com.apple.dock autohide -bool true"]
146
+
147
+ [[rule]]
148
+ id = "mac-accounts"
149
+ title = "create, delete or change accounts and admin group (dscl, sysadminctl, dseditgroup)"
150
+ family = "macos"
151
+ severity = "high"
152
+ action = "ask"
153
+ why = "Account changes create backdoors, remove people's data or lock users out. Adding an account to admin is a privilege escalation."
154
+ safer = "Use System Settings or your MDM, and list the account first (dscl . -read /Users/name)."
155
+ reversible = "no"
156
+ [rule.match]
157
+ cmd = ["dscl", "sysadminctl", "dseditgroup"]
158
+ args_regex = '(?i)(?:-delete|-create|-append|-merge|-change|-passwd|-adduser|-deleteuser|-securetokenoff|-resetpasswordfor|(?:^|\s)-o\s+edit\b)'
159
+ [rule.examples]
160
+ match = ["dscl . -delete /Users/bob", "sysadminctl -deleteUser bob", "dseditgroup -o edit -a eve -t user admin", "dscl . -create /Users/x UserShell /bin/zsh"]
161
+ no_match = ["dscl . -read /Users/bob", "dscl . -list /Users", "sysadminctl -secureTokenStatus bob", "dseditgroup -o read admin"]
162
+
163
+ [[rule]]
164
+ id = "mac-keychain"
165
+ title = "security: delete keychain items, dump keychains, print secrets, trust certificates"
166
+ family = "macos"
167
+ severity = "high"
168
+ action = "ask"
169
+ why = "These commands delete credentials, print passwords in clear text, export keys or make the system trust a new certificate authority."
170
+ safer = "Use Keychain Access for one item and never print secrets into a shell an agent can read."
171
+ reversible = "no"
172
+ [rule.match]
173
+ cmd = ["security"]
174
+ args_regex = '(?i)(?:delete-(?:keychain|generic-password|internet-password|certificate|identity)|remove-trusted-cert|dump-keychain|(?:^|\s)export\b|add-trusted-cert|find-(?:generic|internet)-password\b[^|;&]*\s-\w*[wg]\w*)'
175
+ [rule.examples]
176
+ match = ["security delete-keychain login.keychain-db", "security delete-generic-password -s foo", "security dump-keychain -d login.keychain", "security find-generic-password -s foo -w", "security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ca.pem", "security export -k login.keychain -t certs -f pemseq"]
177
+ no_match = ["security list-keychains", "security find-identity -v -p codesigning", "security find-generic-password -s foo", "security default-keychain"]
178
+
179
+ [[rule]]
180
+ id = "mac-nvram"
181
+ title = "nvram clear or delete (firmware variables)"
182
+ family = "macos"
183
+ severity = "high"
184
+ action = "ask"
185
+ why = "Clearing NVRAM or changing boot-args alters how the Mac boots and can disable security options."
186
+ safer = "Run nvram -p and save the output before changing anything."
187
+ reversible = "no"
188
+ [rule.match]
189
+ cmd = ["nvram"]
190
+ args_regex = '(?i)(?:^|\s)(?:-c|-d\s+\S+)(?:\s|$)|boot-args='
191
+ [rule.examples]
192
+ match = ["nvram -c", "nvram -d boot-args", "sudo nvram boot-args=-v"]
193
+ no_match = ["nvram -p", "nvram boot-args"]
194
+
195
+ [[rule]]
196
+ id = "mac-osascript-risky"
197
+ title = "osascript that elevates, empties the trash, shuts down, restarts or sends keystrokes"
198
+ family = "macos"
199
+ severity = "high"
200
+ action = "ask"
201
+ why = "AppleScript can run commands as administrator, drive other apps through the UI and act as a keyboard, which is a way around other safeguards."
202
+ safer = "Run the specific command directly so it can be reviewed, and ask the user for anything that needs administrator rights."
203
+ reversible = "no"
204
+ [rule.match]
205
+ cmd = ["osascript"]
206
+ args_regex = '(?i)(?:with administrator privileges|empty trash|shut down|restart|log out|keystroke|key code)'
207
+ [rule.examples]
208
+ match = ["osascript -e \"tell app \\\"Finder\\\" to empty trash\"", "osascript -e \"tell app \\\"System Events\\\" to shut down\"", "osascript -e \"do shell script \\\"id\\\" with administrator privileges\"", "osascript -e \"tell application \\\"System Events\\\" to keystroke \\\"q\\\" using command down\""]
209
+ no_match = ["osascript -e \"display notification \\\"hi\\\"\"", "osascript -e \"tell application \\\"Safari\\\" to get URL of current tab of window 1\""]
210
+
211
+ [[rule]]
212
+ id = "mac-kill-session"
213
+ title = "kill WindowServer, loginwindow, launchd or other session processes"
214
+ family = "macos"
215
+ severity = "medium"
216
+ action = "ask"
217
+ why = "Killing these processes logs you out, loses unsaved work in every app or panics the system."
218
+ safer = "Restart the one app you need to restart."
219
+ reversible = "no"
220
+ [rule.match]
221
+ cmd = ["killall", "pkill"]
222
+ args_regex = '(?i)(?:^|\s)(?:-\d+\s+|-kill\s+|-sigkill\s+)?(?:windowserver|loginwindow|launchd|securityd|opendirectoryd|kernel_task)\b'
223
+ [rule.examples]
224
+ match = ["killall -9 WindowServer", "killall loginwindow", "pkill -9 launchd"]
225
+ no_match = ["killall Dock", "killall Finder", "killall node"]
226
+
227
+ [[rule]]
228
+ id = "mac-firewall-off"
229
+ title = "turn off or flush the macOS firewall (pfctl, socketfilterfw)"
230
+ family = "macos"
231
+ severity = "high"
232
+ action = "ask"
233
+ why = "Disabling or flushing the firewall exposes every listening service to the network."
234
+ safer = "Add an allow rule for the one app instead."
235
+ reversible = "no"
236
+ [rule.match]
237
+ cmd = ["pfctl", "socketfilterfw"]
238
+ args_regex = '(?i)(?:-d\b|-f\s+all|--setglobalstate\s+off|--setblockall\s+off|--setstealthmode\s+off)'
239
+ [rule.examples]
240
+ match = ["pfctl -d", "pfctl -F all", "/usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off"]
241
+ no_match = ["pfctl -s rules", "pfctl -e", "socketfilterfw --getglobalstate"]
242
+
243
+ [[rule]]
244
+ id = "mac-networksetup"
245
+ title = "networksetup: change DNS, proxies or remove network services"
246
+ family = "macos"
247
+ severity = "medium"
248
+ action = "ask"
249
+ why = "Changing DNS or proxy settings redirects every connection on the machine, and removing a service can cut your connectivity."
250
+ safer = "Run networksetup -getdnsservers and note the current values before changing them."
251
+ reversible = "no"
252
+ [rule.match]
253
+ cmd = ["networksetup"]
254
+ args_regex = '(?i)^\s*-(?:setdnsservers|setwebproxy|setsecurewebproxy|setautoproxyurl|setproxybypassdomains|removepreferredwirelessnetwork|removenetworkservice|deletepppoeservice|setv6off|setnetworkserviceenabled)\b'
255
+ [rule.examples]
256
+ match = ["networksetup -setdnsservers Wi-Fi 8.8.8.8", "networksetup -setwebproxy Wi-Fi 127.0.0.1 8080", "sudo networksetup -removenetworkservice Ethernet"]
257
+ no_match = ["networksetup -listallnetworkservices", "networksetup -getdnsservers Wi-Fi"]
258
+
259
+ [[rule]]
260
+ id = "mac-tcc-reset"
261
+ title = "tccutil reset (clears privacy permissions)"
262
+ family = "macos"
263
+ severity = "medium"
264
+ action = "ask"
265
+ why = "Resetting TCC clears camera, microphone, screen recording and file access approvals for apps."
266
+ safer = "Reset one service for one bundle id, not All."
267
+ reversible = "no"
268
+ [rule.match]
269
+ cmd = ["tccutil"]
270
+ args_regex = '(?i)^\s*reset\b'
271
+ [rule.examples]
272
+ match = ["tccutil reset All", "tccutil reset Camera com.x"]
273
+ no_match = ["echo tccutil reset All", "tccutil"]
274
+
275
+ [[rule]]
276
+ id = "mac-profiles"
277
+ title = "profiles: install or remove configuration and MDM profiles"
278
+ family = "macos"
279
+ severity = "high"
280
+ action = "ask"
281
+ why = "Configuration profiles carry certificates, VPN, Wi-Fi and security policy. Removing an MDM profile can unenrol a managed device."
282
+ safer = "List installed profiles and talk to your admin before removing one."
283
+ reversible = "no"
284
+ [rule.match]
285
+ cmd = ["profiles"]
286
+ args_regex = '(?i)(?:^|\s)(?:remove|install|-D|-R|-F)\b'
287
+ [rule.examples]
288
+ match = ["profiles remove -all", "profiles -D", "sudo profiles install -path x.mobileconfig"]
289
+ no_match = ["profiles list", "echo profiles remove"]
290
+
291
+ [[rule]]
292
+ id = "mac-systemsetup"
293
+ title = "systemsetup: enable remote login or change remote events"
294
+ family = "macos"
295
+ severity = "high"
296
+ action = "ask"
297
+ why = "Enabling Remote Login or Remote Apple Events opens the Mac to network access."
298
+ safer = "Use System Settings, Sharing and limit it to named users."
299
+ reversible = "no"
300
+ [rule.match]
301
+ cmd = ["systemsetup"]
302
+ args_regex = '(?i)-set(?:remotelogin|remoteappleevents|wakeonmodem|restartfreeze)\b'
303
+ [rule.examples]
304
+ match = ["systemsetup -setremotelogin on", "sudo systemsetup -setremoteappleevents on"]
305
+ no_match = ["systemsetup -getremotelogin", "systemsetup -gettimezone"]