holmesgpt 0.13.0__py3-none-any.whl → 0.13.2__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.
Files changed (118) hide show
  1. holmes/__init__.py +1 -1
  2. holmes/common/env_vars.py +11 -0
  3. holmes/config.py +3 -1
  4. holmes/core/conversations.py +0 -11
  5. holmes/core/investigation.py +0 -6
  6. holmes/core/llm.py +63 -2
  7. holmes/core/prompt.py +0 -2
  8. holmes/core/supabase_dal.py +2 -2
  9. holmes/core/todo_tasks_formatter.py +51 -0
  10. holmes/core/tool_calling_llm.py +277 -101
  11. holmes/core/tools.py +20 -4
  12. holmes/core/toolset_manager.py +1 -5
  13. holmes/core/tracing.py +1 -1
  14. holmes/interactive.py +63 -2
  15. holmes/main.py +7 -2
  16. holmes/plugins/prompts/_fetch_logs.jinja2 +4 -0
  17. holmes/plugins/prompts/_general_instructions.jinja2 +3 -1
  18. holmes/plugins/prompts/investigation_procedure.jinja2 +3 -13
  19. holmes/plugins/runbooks/CLAUDE.md +85 -0
  20. holmes/plugins/runbooks/README.md +24 -0
  21. holmes/plugins/toolsets/__init__.py +5 -1
  22. holmes/plugins/toolsets/argocd.yaml +1 -1
  23. holmes/plugins/toolsets/atlas_mongodb/mongodb_atlas.py +18 -6
  24. holmes/plugins/toolsets/aws.yaml +9 -5
  25. holmes/plugins/toolsets/azure_sql/tools/analyze_connection_failures.py +3 -1
  26. holmes/plugins/toolsets/azure_sql/tools/analyze_database_connections.py +3 -1
  27. holmes/plugins/toolsets/azure_sql/tools/analyze_database_health_status.py +3 -1
  28. holmes/plugins/toolsets/azure_sql/tools/analyze_database_performance.py +3 -1
  29. holmes/plugins/toolsets/azure_sql/tools/analyze_database_storage.py +3 -1
  30. holmes/plugins/toolsets/azure_sql/tools/get_active_alerts.py +3 -1
  31. holmes/plugins/toolsets/azure_sql/tools/get_slow_queries.py +3 -1
  32. holmes/plugins/toolsets/azure_sql/tools/get_top_cpu_queries.py +3 -1
  33. holmes/plugins/toolsets/azure_sql/tools/get_top_data_io_queries.py +3 -1
  34. holmes/plugins/toolsets/azure_sql/tools/get_top_log_io_queries.py +3 -1
  35. holmes/plugins/toolsets/bash/argocd/__init__.py +65 -0
  36. holmes/plugins/toolsets/bash/argocd/constants.py +120 -0
  37. holmes/plugins/toolsets/bash/aws/__init__.py +66 -0
  38. holmes/plugins/toolsets/bash/aws/constants.py +529 -0
  39. holmes/plugins/toolsets/bash/azure/__init__.py +56 -0
  40. holmes/plugins/toolsets/bash/azure/constants.py +339 -0
  41. holmes/plugins/toolsets/bash/bash_instructions.jinja2 +6 -7
  42. holmes/plugins/toolsets/bash/bash_toolset.py +62 -17
  43. holmes/plugins/toolsets/bash/common/bash_command.py +131 -0
  44. holmes/plugins/toolsets/bash/common/stringify.py +14 -1
  45. holmes/plugins/toolsets/bash/common/validators.py +91 -0
  46. holmes/plugins/toolsets/bash/docker/__init__.py +59 -0
  47. holmes/plugins/toolsets/bash/docker/constants.py +255 -0
  48. holmes/plugins/toolsets/bash/helm/__init__.py +61 -0
  49. holmes/plugins/toolsets/bash/helm/constants.py +92 -0
  50. holmes/plugins/toolsets/bash/kubectl/__init__.py +80 -79
  51. holmes/plugins/toolsets/bash/kubectl/constants.py +0 -14
  52. holmes/plugins/toolsets/bash/kubectl/kubectl_describe.py +38 -56
  53. holmes/plugins/toolsets/bash/kubectl/kubectl_events.py +28 -76
  54. holmes/plugins/toolsets/bash/kubectl/kubectl_get.py +39 -99
  55. holmes/plugins/toolsets/bash/kubectl/kubectl_logs.py +34 -15
  56. holmes/plugins/toolsets/bash/kubectl/kubectl_run.py +1 -1
  57. holmes/plugins/toolsets/bash/kubectl/kubectl_top.py +38 -77
  58. holmes/plugins/toolsets/bash/parse_command.py +106 -32
  59. holmes/plugins/toolsets/bash/utilities/__init__.py +0 -0
  60. holmes/plugins/toolsets/bash/utilities/base64_util.py +12 -0
  61. holmes/plugins/toolsets/bash/utilities/cut.py +12 -0
  62. holmes/plugins/toolsets/bash/utilities/grep/__init__.py +10 -0
  63. holmes/plugins/toolsets/bash/utilities/head.py +12 -0
  64. holmes/plugins/toolsets/bash/utilities/jq.py +79 -0
  65. holmes/plugins/toolsets/bash/utilities/sed.py +164 -0
  66. holmes/plugins/toolsets/bash/utilities/sort.py +15 -0
  67. holmes/plugins/toolsets/bash/utilities/tail.py +12 -0
  68. holmes/plugins/toolsets/bash/utilities/tr.py +57 -0
  69. holmes/plugins/toolsets/bash/utilities/uniq.py +12 -0
  70. holmes/plugins/toolsets/bash/utilities/wc.py +12 -0
  71. holmes/plugins/toolsets/confluence.yaml +1 -1
  72. holmes/plugins/toolsets/coralogix/api.py +3 -1
  73. holmes/plugins/toolsets/coralogix/toolset_coralogix_logs.py +4 -4
  74. holmes/plugins/toolsets/coralogix/utils.py +41 -14
  75. holmes/plugins/toolsets/datadog/datadog_api.py +45 -2
  76. holmes/plugins/toolsets/datadog/datadog_general_instructions.jinja2 +208 -0
  77. holmes/plugins/toolsets/datadog/datadog_logs_instructions.jinja2 +43 -0
  78. holmes/plugins/toolsets/datadog/datadog_metrics_instructions.jinja2 +12 -9
  79. holmes/plugins/toolsets/datadog/toolset_datadog_general.py +722 -0
  80. holmes/plugins/toolsets/datadog/toolset_datadog_logs.py +17 -6
  81. holmes/plugins/toolsets/datadog/toolset_datadog_metrics.py +15 -7
  82. holmes/plugins/toolsets/datadog/toolset_datadog_rds.py +6 -2
  83. holmes/plugins/toolsets/datadog/toolset_datadog_traces.py +9 -3
  84. holmes/plugins/toolsets/docker.yaml +1 -1
  85. holmes/plugins/toolsets/git.py +15 -5
  86. holmes/plugins/toolsets/grafana/toolset_grafana.py +25 -4
  87. holmes/plugins/toolsets/grafana/toolset_grafana_loki.py +4 -4
  88. holmes/plugins/toolsets/grafana/toolset_grafana_tempo.jinja2 +5 -3
  89. holmes/plugins/toolsets/grafana/toolset_grafana_tempo.py +299 -32
  90. holmes/plugins/toolsets/helm.yaml +1 -1
  91. holmes/plugins/toolsets/internet/internet.py +4 -2
  92. holmes/plugins/toolsets/internet/notion.py +4 -2
  93. holmes/plugins/toolsets/investigator/core_investigation.py +5 -17
  94. holmes/plugins/toolsets/investigator/investigator_instructions.jinja2 +1 -5
  95. holmes/plugins/toolsets/kafka.py +19 -7
  96. holmes/plugins/toolsets/kubernetes.yaml +5 -5
  97. holmes/plugins/toolsets/kubernetes_logs.py +4 -4
  98. holmes/plugins/toolsets/kubernetes_logs.yaml +1 -1
  99. holmes/plugins/toolsets/logging_utils/logging_api.py +15 -2
  100. holmes/plugins/toolsets/mcp/toolset_mcp.py +3 -1
  101. holmes/plugins/toolsets/newrelic.py +8 -4
  102. holmes/plugins/toolsets/opensearch/opensearch.py +13 -5
  103. holmes/plugins/toolsets/opensearch/opensearch_logs.py +4 -4
  104. holmes/plugins/toolsets/opensearch/opensearch_traces.py +9 -6
  105. holmes/plugins/toolsets/prometheus/prometheus.py +198 -57
  106. holmes/plugins/toolsets/rabbitmq/toolset_rabbitmq.py +7 -3
  107. holmes/plugins/toolsets/robusta/robusta.py +10 -4
  108. holmes/plugins/toolsets/runbook/runbook_fetcher.py +4 -2
  109. holmes/plugins/toolsets/servicenow/servicenow.py +9 -3
  110. holmes/plugins/toolsets/slab.yaml +1 -1
  111. holmes/utils/console/logging.py +6 -1
  112. {holmesgpt-0.13.0.dist-info → holmesgpt-0.13.2.dist-info}/METADATA +3 -2
  113. {holmesgpt-0.13.0.dist-info → holmesgpt-0.13.2.dist-info}/RECORD +116 -90
  114. holmes/core/todo_manager.py +0 -88
  115. holmes/plugins/toolsets/bash/grep/__init__.py +0 -52
  116. {holmesgpt-0.13.0.dist-info → holmesgpt-0.13.2.dist-info}/LICENSE.txt +0 -0
  117. {holmesgpt-0.13.0.dist-info → holmesgpt-0.13.2.dist-info}/WHEEL +0 -0
  118. {holmesgpt-0.13.0.dist-info → holmesgpt-0.13.2.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,529 @@
1
+ ALLOWED_AWS_COMMANDS: dict[str, dict] = {
2
+ # Compute services (read-only)
3
+ "ec2": {
4
+ "describe-instances": {},
5
+ "describe-images": {},
6
+ "describe-volumes": {},
7
+ "describe-snapshots": {},
8
+ "describe-security-groups": {},
9
+ "describe-subnets": {},
10
+ "describe-vpcs": {},
11
+ "describe-internet-gateways": {},
12
+ "describe-route-tables": {},
13
+ "describe-network-acls": {},
14
+ "describe-nat-gateways": {},
15
+ "describe-addresses": {},
16
+ "describe-key-pairs": {},
17
+ "describe-availability-zones": {},
18
+ "describe-regions": {},
19
+ "describe-instance-types": {},
20
+ "describe-instance-attribute": {},
21
+ "describe-instance-status": {},
22
+ "describe-placement-groups": {},
23
+ "describe-reserved-instances": {},
24
+ "describe-spot-instances": {},
25
+ "describe-spot-price-history": {},
26
+ "describe-elastic-gpus": {},
27
+ "describe-capacity-reservations": {},
28
+ "describe-launch-templates": {},
29
+ "describe-launch-template-versions": {},
30
+ "describe-fleet-instances": {},
31
+ "describe-fleets": {},
32
+ "get-console-output": {},
33
+ "get-console-screenshot": {},
34
+ "get-instance-uefi-data": {},
35
+ "list-images-in-recycle-bin": {},
36
+ "list-snapshots-in-recycle-bin": {},
37
+ },
38
+ "lambda": {
39
+ "list-functions": {},
40
+ "list-layers": {},
41
+ "list-layer-versions": {},
42
+ "list-versions-by-function": {},
43
+ "list-aliases": {},
44
+ "get-function": {},
45
+ "get-function-configuration": {},
46
+ "get-layer-version": {},
47
+ "get-alias": {},
48
+ "get-policy": {},
49
+ "get-account-settings": {},
50
+ "get-event-source-mapping": {},
51
+ "list-event-source-mappings": {},
52
+ "get-function-code-signing-config": {},
53
+ "get-code-signing-config": {},
54
+ "list-code-signing-configs": {},
55
+ "list-function-event-invoke-configs": {},
56
+ "get-function-event-invoke-config": {},
57
+ "get-provisioned-concurrency-config": {},
58
+ "list-provisioned-concurrency-configs": {},
59
+ },
60
+ "ecs": {
61
+ "list-clusters": {},
62
+ "list-services": {},
63
+ "list-tasks": {},
64
+ "list-container-instances": {},
65
+ "list-task-definitions": {},
66
+ "list-task-definition-families": {},
67
+ "describe-clusters": {},
68
+ "describe-services": {},
69
+ "describe-tasks": {},
70
+ "describe-task-definition": {},
71
+ "describe-container-instances": {},
72
+ "describe-capacity-providers": {},
73
+ "list-capacity-providers": {},
74
+ "list-attributes": {},
75
+ "list-tags-for-resource": {},
76
+ },
77
+ # Storage services (read-only)
78
+ "s3": {
79
+ "list-buckets": {},
80
+ "list-objects": {},
81
+ "list-objects-v2": {},
82
+ "head-bucket": {},
83
+ "head-object": {},
84
+ "get-bucket-location": {},
85
+ "get-bucket-versioning": {},
86
+ "get-bucket-tagging": {},
87
+ "get-bucket-policy-status": {},
88
+ "get-bucket-encryption": {},
89
+ "get-bucket-cors": {},
90
+ "get-bucket-website": {},
91
+ "get-bucket-lifecycle": {},
92
+ "get-bucket-lifecycle-configuration": {},
93
+ "get-bucket-replication": {},
94
+ "get-bucket-request-payment": {},
95
+ "get-bucket-notification": {},
96
+ "get-bucket-notification-configuration": {},
97
+ "get-bucket-inventory-configuration": {},
98
+ "list-bucket-inventory-configurations": {},
99
+ "get-bucket-metrics-configuration": {},
100
+ "list-bucket-metrics-configurations": {},
101
+ "get-bucket-analytics-configuration": {},
102
+ "list-bucket-analytics-configurations": {},
103
+ "get-bucket-intelligent-tiering-configuration": {},
104
+ "list-bucket-intelligent-tiering-configurations": {},
105
+ "get-object-attributes": {},
106
+ "get-object-legal-hold": {},
107
+ "get-object-lock-configuration": {},
108
+ "get-object-retention": {},
109
+ "get-object-tagging": {},
110
+ "get-object-torrent": {},
111
+ "list-multipart-uploads": {},
112
+ "list-object-versions": {},
113
+ "list-parts": {},
114
+ },
115
+ "s3api": {
116
+ "list-buckets": {},
117
+ "list-objects": {},
118
+ "list-objects-v2": {},
119
+ "head-bucket": {},
120
+ "head-object": {},
121
+ "get-bucket-location": {},
122
+ "get-bucket-versioning": {},
123
+ "get-bucket-tagging": {},
124
+ "get-bucket-policy-status": {},
125
+ "get-bucket-encryption": {},
126
+ "get-bucket-cors": {},
127
+ "get-bucket-website": {},
128
+ "get-bucket-lifecycle": {},
129
+ "get-bucket-lifecycle-configuration": {},
130
+ "get-bucket-replication": {},
131
+ "get-bucket-request-payment": {},
132
+ "get-bucket-notification": {},
133
+ "get-bucket-notification-configuration": {},
134
+ "get-bucket-inventory-configuration": {},
135
+ "list-bucket-inventory-configurations": {},
136
+ "get-bucket-metrics-configuration": {},
137
+ "list-bucket-metrics-configurations": {},
138
+ "get-bucket-analytics-configuration": {},
139
+ "list-bucket-analytics-configurations": {},
140
+ "get-bucket-intelligent-tiering-configuration": {},
141
+ "list-bucket-intelligent-tiering-configurations": {},
142
+ "get-object-attributes": {},
143
+ "get-object-legal-hold": {},
144
+ "get-object-lock-configuration": {},
145
+ "get-object-retention": {},
146
+ "get-object-tagging": {},
147
+ "get-object-torrent": {},
148
+ "list-multipart-uploads": {},
149
+ "list-object-versions": {},
150
+ "list-parts": {},
151
+ },
152
+ "ebs": {
153
+ "describe-volumes": {},
154
+ "describe-volume-status": {},
155
+ "describe-volume-attribute": {},
156
+ "describe-snapshots": {},
157
+ "describe-snapshot-attribute": {},
158
+ "describe-fast-snapshot-restores": {},
159
+ "list-snapshots-in-recycle-bin": {},
160
+ },
161
+ # Database services (read-only)
162
+ "rds": {
163
+ "describe-db-instances": {},
164
+ "describe-db-clusters": {},
165
+ "describe-db-snapshots": {},
166
+ "describe-db-cluster-snapshots": {},
167
+ "describe-db-parameter-groups": {},
168
+ "describe-db-cluster-parameter-groups": {},
169
+ "describe-db-parameters": {},
170
+ "describe-db-cluster-parameters": {},
171
+ "describe-db-subnet-groups": {},
172
+ "describe-db-security-groups": {},
173
+ "describe-option-groups": {},
174
+ "describe-db-log-files": {},
175
+ "describe-db-engine-versions": {},
176
+ "describe-reserved-db-instances": {},
177
+ "describe-reserved-db-instances-offerings": {},
178
+ "describe-event-categories": {},
179
+ "describe-event-subscriptions": {},
180
+ "describe-events": {},
181
+ "describe-pending-maintenance-actions": {},
182
+ "describe-certificates": {},
183
+ "describe-account-quotas": {},
184
+ "describe-orderable-db-instance-options": {},
185
+ "describe-valid-db-instance-modifications": {},
186
+ "list-tags-for-resource": {},
187
+ },
188
+ "dynamodb": {
189
+ "list-tables": {},
190
+ "describe-table": {},
191
+ "describe-time-to-live": {},
192
+ "describe-continuous-backups": {},
193
+ "describe-backup": {},
194
+ "list-backups": {},
195
+ "describe-global-table": {},
196
+ "list-global-tables": {},
197
+ "describe-global-table-settings": {},
198
+ "describe-limits": {},
199
+ "describe-endpoints": {},
200
+ "list-tags-of-resource": {},
201
+ "describe-contributor-insights": {},
202
+ "list-contributor-insights": {},
203
+ "describe-kinesis-streaming-destination": {},
204
+ "describe-table-replica-auto-scaling": {},
205
+ "describe-stream": {},
206
+ "list-streams": {},
207
+ },
208
+ # Monitoring and logging (read-only)
209
+ "cloudwatch": {
210
+ "list-metrics": {},
211
+ "get-metric-statistics": {},
212
+ "get-metric-data": {},
213
+ "describe-alarms": {},
214
+ "describe-alarm-history": {},
215
+ "describe-anomaly-detectors": {},
216
+ "get-dashboard": {},
217
+ "list-dashboards": {},
218
+ "list-tags-for-resource": {},
219
+ "get-insight-selectors": {},
220
+ "get-metric-widget-image": {},
221
+ "describe-insight-rules": {},
222
+ },
223
+ "logs": {
224
+ "describe-destinations": {},
225
+ "describe-export-tasks": {},
226
+ "describe-log-groups": {},
227
+ "describe-log-streams": {},
228
+ "describe-metric-filters": {},
229
+ "describe-queries": {},
230
+ "describe-resource-policies": {},
231
+ "describe-subscription-filters": {},
232
+ "get-log-events": {},
233
+ "filter-log-events": {},
234
+ "get-query-results": {},
235
+ "list-tags-log-group": {},
236
+ "test-metric-filter": {},
237
+ },
238
+ "cloudtrail": {
239
+ "describe-trails": {},
240
+ "get-trail-status": {},
241
+ "list-public-keys": {},
242
+ "list-tags": {},
243
+ "lookup-events": {},
244
+ "get-insight-selectors": {},
245
+ "get-event-selectors": {},
246
+ "describe-query": {},
247
+ "list-queries": {},
248
+ "get-query-results": {},
249
+ },
250
+ # Networking (read-only)
251
+ "elbv2": {
252
+ "describe-load-balancers": {},
253
+ "describe-listeners": {},
254
+ "describe-listener-certificates": {},
255
+ "describe-rules": {},
256
+ "describe-target-groups": {},
257
+ "describe-target-health": {},
258
+ "describe-target-group-attributes": {},
259
+ "describe-load-balancer-attributes": {},
260
+ "describe-ssl-policies": {},
261
+ "describe-account-limits": {},
262
+ "list-tags-for-resource": {},
263
+ },
264
+ "elb": {
265
+ "describe-load-balancers": {},
266
+ "describe-load-balancer-attributes": {},
267
+ "describe-load-balancer-policies": {},
268
+ "describe-load-balancer-policy-types": {},
269
+ "describe-instance-health": {},
270
+ "describe-account-limits": {},
271
+ "list-tags-for-resource": {},
272
+ },
273
+ "route53": {
274
+ "list-hosted-zones": {},
275
+ "list-resource-record-sets": {},
276
+ "get-hosted-zone": {},
277
+ "get-hosted-zone-count": {},
278
+ "get-health-check": {},
279
+ "list-health-checks": {},
280
+ "get-health-check-count": {},
281
+ "get-health-check-status": {},
282
+ "get-health-check-last-failure-reason": {},
283
+ "list-tags-for-resource": {},
284
+ "list-tags-for-resources": {},
285
+ "get-change": {},
286
+ "list-geo-locations": {},
287
+ "get-geo-location": {},
288
+ "get-account-limit": {},
289
+ "get-hosted-zone-limit": {},
290
+ "list-vpc-association-authorizations": {},
291
+ "list-query-logging-configs": {},
292
+ "get-query-logging-config": {},
293
+ "get-dnssec": {},
294
+ "list-cidr-blocks": {},
295
+ "list-cidr-collections": {},
296
+ "list-cidr-locations": {},
297
+ "get-cidr-collection": {},
298
+ },
299
+ "cloudfront": {
300
+ "list-distributions": {},
301
+ "get-distribution": {},
302
+ "get-distribution-config": {},
303
+ "list-streaming-distributions": {},
304
+ "get-streaming-distribution": {},
305
+ "get-streaming-distribution-config": {},
306
+ "list-cloud-front-origin-access-identities": {},
307
+ "get-cloud-front-origin-access-identity": {},
308
+ "get-cloud-front-origin-access-identity-config": {},
309
+ "list-invalidations": {},
310
+ "get-invalidation": {},
311
+ "list-tags-for-resource": {},
312
+ },
313
+ # Identity and Access (read-only)
314
+ "iam": {
315
+ "list-users": {},
316
+ "list-groups": {},
317
+ "list-roles": {},
318
+ "list-policies": {},
319
+ "list-attached-user-policies": {},
320
+ "list-attached-group-policies": {},
321
+ "list-attached-role-policies": {},
322
+ "list-user-policies": {},
323
+ "list-group-policies": {},
324
+ "list-role-policies": {},
325
+ "get-user": {},
326
+ "get-group": {},
327
+ "get-role": {},
328
+ "get-policy": {},
329
+ "get-policy-version": {},
330
+ "list-policy-versions": {},
331
+ "get-account-summary": {},
332
+ "get-account-password-policy": {},
333
+ "list-entities-for-policy": {},
334
+ "list-groups-for-user": {},
335
+ "simulate-custom-policy": {},
336
+ "simulate-principal-policy": {},
337
+ "get-context-keys-for-custom-policy": {},
338
+ "get-context-keys-for-principal-policy": {},
339
+ "list-mfa-devices": {},
340
+ "list-virtual-mfa-devices": {},
341
+ "list-ssh-public-keys": {},
342
+ "get-ssh-public-key": {},
343
+ "list-service-specific-credentials": {},
344
+ "list-access-keys": {},
345
+ "list-signing-certificates": {},
346
+ "get-login-profile": {},
347
+ "generate-credential-report": {},
348
+ "get-credential-report": {},
349
+ "generate-service-last-accessed-details": {},
350
+ "get-service-last-accessed-details": {},
351
+ "get-service-last-accessed-details-with-entities": {},
352
+ "list-policies-granting-service-access": {},
353
+ "list-instance-profiles": {},
354
+ "get-instance-profile": {},
355
+ "list-instance-profiles-for-role": {},
356
+ "list-open-id-connect-providers": {},
357
+ "get-open-id-connect-provider": {},
358
+ "list-saml-providers": {},
359
+ "get-saml-provider": {},
360
+ "list-server-certificates": {},
361
+ "get-server-certificate": {},
362
+ "get-account-authorization-details": {},
363
+ "list-tags-for-user": {},
364
+ "list-tags-for-role": {},
365
+ },
366
+ # Systems Manager (read-only)
367
+ "ssm": {
368
+ "describe-instance-information": {},
369
+ "describe-instance-associations-status": {},
370
+ "describe-instance-patch-states": {},
371
+ "describe-instance-patch-states-for-patch-group": {},
372
+ "describe-parameters": {},
373
+ "get-parameter": {},
374
+ "get-parameters": {},
375
+ "get-parameters-by-path": {},
376
+ "describe-document-parameters": {},
377
+ "describe-document-permission": {},
378
+ "list-documents": {},
379
+ "describe-document": {},
380
+ "get-document": {},
381
+ "list-associations": {},
382
+ "describe-association": {},
383
+ "describe-association-executions": {},
384
+ "describe-association-execution-targets": {},
385
+ "list-command-invocations": {},
386
+ "list-commands": {},
387
+ "get-command-invocation": {},
388
+ "describe-automation-executions": {},
389
+ "describe-automation-step-executions": {},
390
+ "get-automation-execution": {},
391
+ "describe-available-patches": {},
392
+ "describe-effective-instance-associations": {},
393
+ "describe-effective-patches-for-patch-group": {},
394
+ "describe-inventory-deletions": {},
395
+ "describe-maintenance-window-executions": {},
396
+ "describe-maintenance-window-execution-task-invocations": {},
397
+ "describe-maintenance-window-execution-tasks": {},
398
+ "describe-maintenance-window-schedule": {},
399
+ "describe-maintenance-window-targets": {},
400
+ "describe-maintenance-window-tasks": {},
401
+ "describe-maintenance-windows": {},
402
+ "describe-maintenance-windows-for-target": {},
403
+ "describe-ops-items": {},
404
+ "get-ops-item": {},
405
+ "describe-patch-baselines": {},
406
+ "describe-patch-groups": {},
407
+ "get-patch-baseline": {},
408
+ "get-patch-baseline-for-patch-group": {},
409
+ "describe-sessions": {},
410
+ "get-connection-status": {},
411
+ "list-compliance-items": {},
412
+ "list-compliance-summaries": {},
413
+ "list-resource-compliance-summaries": {},
414
+ "list-resource-data-sync": {},
415
+ "list-tags-for-resource": {},
416
+ "get-calendar-state": {},
417
+ "get-inventory": {},
418
+ "get-inventory-schema": {},
419
+ "list-inventory-entries": {},
420
+ "get-ops-metadata": {},
421
+ "list-ops-metadata": {},
422
+ "get-service-setting": {},
423
+ "list-document-versions": {},
424
+ },
425
+ # Help and information
426
+ "help": {},
427
+ "version": {},
428
+ # Completion
429
+ "completion": {},
430
+ }
431
+
432
+
433
+ DENIED_AWS_COMMANDS: dict[str, dict] = {
434
+ # Services that modify state or access sensitive data
435
+ "configure": {},
436
+ "deploy": {},
437
+ "s3-sync": {},
438
+ # Services that can access secrets/sensitive data
439
+ "secretsmanager": {},
440
+ "kms": {},
441
+ "ssm-get-parameter": {}, # Can access secrets in Parameter Store
442
+ "sts": {}, # Can return credentials/tokens
443
+ "cognito-identity": {},
444
+ "cognito-idp": {},
445
+ # Services that perform actions
446
+ "ses": {},
447
+ "sns": {},
448
+ "sqs": {},
449
+ "kinesis": {},
450
+ "firehose": {},
451
+ "glue": {},
452
+ "athena": {},
453
+ "redshift": {},
454
+ "emr": {},
455
+ "batch": {},
456
+ "ecs-execute-command": {}, # Can execute commands in containers
457
+ # Wildcard operations that apply to all services
458
+ "*": {
459
+ # Create operations
460
+ "create-*": {},
461
+ "run-*": {},
462
+ "start-*": {},
463
+ "launch-*": {},
464
+ "allocate-*": {},
465
+ "associate-*": {},
466
+ "attach-*": {},
467
+ "authorize-*": {},
468
+ "import-*": {},
469
+ "register-*": {},
470
+ # Modify operations
471
+ "modify-*": {},
472
+ "update-*": {},
473
+ "put-*": {},
474
+ "set-*": {},
475
+ "replace-*": {},
476
+ "reset-*": {},
477
+ "configure-*": {},
478
+ "enable-*": {},
479
+ "disable-*": {},
480
+ "change-*": {},
481
+ "edit-*": {},
482
+ "tag-*": {},
483
+ "untag-*": {},
484
+ # Delete operations
485
+ "delete-*": {},
486
+ "terminate-*": {},
487
+ "stop-*": {},
488
+ "cancel-*": {},
489
+ "deregister-*": {},
490
+ "detach-*": {},
491
+ "disassociate-*": {},
492
+ "remove-*": {},
493
+ "revoke-*": {},
494
+ "release-*": {},
495
+ "deallocate-*": {},
496
+ # Actions that can trigger changes
497
+ "invoke": {},
498
+ "reboot-*": {},
499
+ "restore-*": {},
500
+ "copy-*": {},
501
+ "move-*": {},
502
+ "migrate-*": {},
503
+ "promote-*": {},
504
+ "failover-*": {},
505
+ "rebuild-*": {},
506
+ "resize-*": {},
507
+ "scale-*": {},
508
+ "invoke-*": {}, # Lambda invocations
509
+ "send-*": {}, # SES/SNS sending
510
+ "publish-*": {}, # SNS publishing
511
+ "execute-*": {}, # Executing commands/queries
512
+ # S3 specific file operations
513
+ "cp": {}, # s3 cp
514
+ "mv": {}, # s3 mv
515
+ "rm": {}, # s3 rm
516
+ "mb": {}, # s3 mb (make bucket)
517
+ "rb": {}, # s3 rb (remove bucket)
518
+ "sync": {}, # s3 sync
519
+ # Sensitive data access
520
+ "get-secret-*": {},
521
+ "get-parameter-*": {}, # Can access sensitive SSM parameters
522
+ "decrypt-*": {},
523
+ "generate-*": {},
524
+ "assume-*": {},
525
+ "get-session-token": {},
526
+ "get-federation-token": {},
527
+ "get-caller-identity": {},
528
+ },
529
+ }
@@ -0,0 +1,56 @@
1
+ import argparse
2
+ from typing import Any, Optional
3
+
4
+ from holmes.plugins.toolsets.bash.common.bash_command import BashCommand
5
+ from holmes.plugins.toolsets.bash.common.config import BashExecutorConfig
6
+ from holmes.plugins.toolsets.bash.common.stringify import escape_shell_args
7
+ from holmes.plugins.toolsets.bash.common.validators import (
8
+ validate_command_and_operations,
9
+ )
10
+ from holmes.plugins.toolsets.bash.azure.constants import (
11
+ ALLOWED_AZURE_COMMANDS,
12
+ DENIED_AZURE_COMMANDS,
13
+ )
14
+
15
+
16
+ class AzureCommand(BashCommand):
17
+ def __init__(self):
18
+ super().__init__("az")
19
+
20
+ def add_parser(self, parent_parser: Any):
21
+ azure_parser = parent_parser.add_parser(
22
+ "az", help="Azure Command Line Interface", exit_on_error=False
23
+ )
24
+
25
+ azure_parser.add_argument(
26
+ "service", help="Azure service or command (e.g., vm, network, storage)"
27
+ )
28
+
29
+ azure_parser.add_argument(
30
+ "options",
31
+ nargs=argparse.REMAINDER,
32
+ default=[],
33
+ help="Azure CLI subcommands, operations, and options",
34
+ )
35
+ return azure_parser
36
+
37
+ def validate_command(
38
+ self, command: Any, original_command: str, config: Optional[BashExecutorConfig]
39
+ ) -> None:
40
+ if hasattr(command, "options"):
41
+ validate_command_and_operations(
42
+ command=command.service,
43
+ options=command.options,
44
+ allowed_commands=ALLOWED_AZURE_COMMANDS,
45
+ denied_commands=DENIED_AZURE_COMMANDS,
46
+ )
47
+
48
+ def stringify_command(
49
+ self, command: Any, original_command: str, config: Optional[BashExecutorConfig]
50
+ ) -> str:
51
+ parts = ["az", command.service]
52
+
53
+ if hasattr(command, "options") and command.options:
54
+ parts.extend(command.options)
55
+
56
+ return " ".join(escape_shell_args(parts))