howler-sentinel-plugin 0.2.0.dev99__py3-none-any.whl → 0.2.0.dev102__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: howler-sentinel-plugin
3
- Version: 0.2.0.dev99
3
+ Version: 0.2.0.dev102
4
4
  Summary: A howler plugin for integration with Microsoft's Sentinel API
5
5
  License: MIT
6
6
  Author: CCCS
@@ -0,0 +1,17 @@
1
+ sentinel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ sentinel/actions/azure_emit_hash.py,sha256=NyqWqe7BshQBq4YfTkGGkLAek6YImqnlpSWMABRdVxM,2939
3
+ sentinel/actions/send_to_sentinel.py,sha256=Y2Ps2a715G2edCJXY5x1UNJkj-qwGkJ_0WYiAdCScXk,3973
4
+ sentinel/actions/update_defender_xdr_alert.py,sha256=gXuVZfr7Ou0Lc6BuECmo18E8hfJPhUlM1VMKVCkofk4,6753
5
+ sentinel/mapping/sentinel_incident.py,sha256=U7fIh8N4Jdr1A4z1E0jPRP28Ll0Cq7u9Q6292AnyRDI,9548
6
+ sentinel/mapping/xdr_alert.py,sha256=UPoqdZsjUXmJz0dCf_qMlh9Jr0D2HcSNOFvbg8lE4wY,18250
7
+ sentinel/mapping/xdr_alert_evidence.py,sha256=q622G4eZwFR3TCj418ZCpE83DGVicrWIQZo8Gkj_3FM,31323
8
+ sentinel/odm/hit.py,sha256=hAuO2ONMK3Ml8Xu6E7tHrmZ7M6HG5tT38RD9ZxwY254,666
9
+ sentinel/odm/models/sentinel.py,sha256=XT3XdT92uoCV5vmY9dT1jmcxRyuu9vp1gE8AwZdKBIc,337
10
+ sentinel/routes/__init__.py,sha256=JYmKRwIfEsiPos1XuMQ2mlGDbxk6TN_cVEM0K_RNze4,130
11
+ sentinel/routes/ingest.py,sha256=_9OdOw_9nBJseKIBnmHDLjnqZ_bDdM4wfLpLrek4-ak,7018
12
+ sentinel/utils/tenant_utils.py,sha256=nGOCbLzUx9OyATLAZ5UbW0WNao_1ioW4wL-htn2ltKU,1324
13
+ howler_sentinel_plugin-0.2.0.dev102.dist-info/LICENSE,sha256=Wg2luVnxEkP2NSn11nh1US6W_nFFbICBAVTG9iG3t5M,1091
14
+ howler_sentinel_plugin-0.2.0.dev102.dist-info/METADATA,sha256=x6T8WqMLWPJYYrB6_cLfcbNPf3RpRHjQ6AOoGp8wZMw,749
15
+ howler_sentinel_plugin-0.2.0.dev102.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
16
+ howler_sentinel_plugin-0.2.0.dev102.dist-info/entry_points.txt,sha256=4IJyMY0V49s3Wp659ngN_7U8g66-czeKxI-_dNAFP5g,60
17
+ howler_sentinel_plugin-0.2.0.dev102.dist-info/RECORD,,
@@ -83,7 +83,7 @@ def specification():
83
83
  return {
84
84
  "id": OPERATION_ID,
85
85
  "title": "Emit sha256 hash to Sentinel",
86
- "priority": 8,
86
+ "priority": 28,
87
87
  "i18nKey": "operations.add_label",
88
88
  "description": {
89
89
  "short": "Add a label to a hit",
@@ -50,7 +50,7 @@ def execute(query: str, **kwargs):
50
50
  continue
51
51
 
52
52
  try:
53
- token, credentials = get_token(tenant_id)
53
+ token, credentials = get_token(tenant_id, "https://monitor.azure.com/.default")
54
54
  except HowlerRuntimeError as err:
55
55
  logger.exception("Error on token fetching")
56
56
  report.append(
@@ -79,6 +79,11 @@ def execute(query: str, **kwargs):
79
79
 
80
80
  response = requests.post(uri, headers=headers, json=payload, timeout=5.0)
81
81
  if not response.ok:
82
+ logger.warning(
83
+ "POST request to Azure Monitor failed with status code %s. Content:\n%s",
84
+ response.status_code,
85
+ response.text,
86
+ )
82
87
  report.append(
83
88
  {
84
89
  "query": f"howler.id:{hit.howler.id}",
@@ -89,7 +89,7 @@ def execute(query: str, **kwargs):
89
89
  continue
90
90
 
91
91
  try:
92
- token = get_token(tenant_id)[0]
92
+ token = get_token(tenant_id, "https://graph.microsoft.com/.default")[0]
93
93
  except HowlerRuntimeError as err:
94
94
  logger.exception("Error on token fetching")
95
95
  report.append(
@@ -106,7 +106,11 @@ def execute(query: str, **kwargs):
106
106
  alert_url = f"https://graph.microsoft.com/v1.0/security/alerts_v2/{hit.rule.id}"
107
107
  response = requests.get(alert_url, headers={"Authorization": f"Bearer {token}"}, timeout=5.0)
108
108
  if not response.ok:
109
- logger.warning("GET request to Microsoft Graph failed with status code %s.", response.status_code)
109
+ logger.warning(
110
+ "GET request to Microsoft Graph failed with status code %s. Content:\n%s",
111
+ response.status_code,
112
+ response.text,
113
+ )
110
114
  report.append(
111
115
  {
112
116
  "query": query,
@@ -148,6 +152,11 @@ def execute(query: str, **kwargs):
148
152
  timeout=5.0,
149
153
  )
150
154
  if not response.ok:
155
+ logger.warning(
156
+ "PATCH request to Microsoft Graph failed with status code %s. Content:\n%s",
157
+ response.status_code,
158
+ response.text,
159
+ )
151
160
  report.append(
152
161
  {
153
162
  "query": query,
@@ -76,7 +76,7 @@ class SentinelIncident:
76
76
  "score": self.map_severity_to_score(severity),
77
77
  "outline.summary": description,
78
78
  "rationale": resolving_comment,
79
- "analytic": "MSGraph",
79
+ "analytic": "Sentinel",
80
80
  "is_bundle": True,
81
81
  "bundle_size": 0,
82
82
  "hits": [],
@@ -10,7 +10,7 @@ logger = get_logger(__file__)
10
10
 
11
11
 
12
12
  @cache.memoize(15 * 60)
13
- def get_token(tenant_id: str) -> tuple[str, dict[str, str]]:
13
+ def get_token(tenant_id: str, scope: str) -> tuple[str, dict[str, str]]:
14
14
  """Get a borealis token based on the current howler token"""
15
15
  # Get bearer token
16
16
  try:
@@ -18,6 +18,8 @@ def get_token(tenant_id: str) -> tuple[str, dict[str, str]]:
18
18
  except (KeyError, json.JSONDecodeError):
19
19
  raise HowlerRuntimeError("Credential data not configured.")
20
20
 
21
+ logger.info("Generating client credential token for client id %s with scope %s", credentials["client_id"], scope)
22
+
21
23
  token_request_url = f"https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token"
22
24
  response = requests.post(
23
25
  token_request_url,
@@ -25,7 +27,7 @@ def get_token(tenant_id: str) -> tuple[str, dict[str, str]]:
25
27
  "grant_type": "client_credentials",
26
28
  "client_id": credentials["client_id"],
27
29
  "client_secret": credentials["client_secret"],
28
- "scope": "https://monitor.azure.com/.default",
30
+ "scope": scope,
29
31
  },
30
32
  timeout=5.0,
31
33
  )
@@ -1,17 +0,0 @@
1
- sentinel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- sentinel/actions/azure_emit_hash.py,sha256=yEO8ZjFTUjNm03fJfHRVER3xf0v5o0qdU8GnqwZtMTM,2938
3
- sentinel/actions/send_to_sentinel.py,sha256=rfIJk02iAACvb8bfKv9MEkSDILDnvXlxt49hQVyvvQ4,3734
4
- sentinel/actions/update_defender_xdr_alert.py,sha256=OjNXM8DixURYdl7fHLCS81I0izQVtQgFkw9Iteeklwg,6418
5
- sentinel/mapping/sentinel_incident.py,sha256=3QBnP6qFpJgE3pHvx5VvFnB3m2TVOoWxs8OysDlJVV8,9547
6
- sentinel/mapping/xdr_alert.py,sha256=UPoqdZsjUXmJz0dCf_qMlh9Jr0D2HcSNOFvbg8lE4wY,18250
7
- sentinel/mapping/xdr_alert_evidence.py,sha256=q622G4eZwFR3TCj418ZCpE83DGVicrWIQZo8Gkj_3FM,31323
8
- sentinel/odm/hit.py,sha256=hAuO2ONMK3Ml8Xu6E7tHrmZ7M6HG5tT38RD9ZxwY254,666
9
- sentinel/odm/models/sentinel.py,sha256=XT3XdT92uoCV5vmY9dT1jmcxRyuu9vp1gE8AwZdKBIc,337
10
- sentinel/routes/__init__.py,sha256=JYmKRwIfEsiPos1XuMQ2mlGDbxk6TN_cVEM0K_RNze4,130
11
- sentinel/routes/ingest.py,sha256=_9OdOw_9nBJseKIBnmHDLjnqZ_bDdM4wfLpLrek4-ak,7018
12
- sentinel/utils/tenant_utils.py,sha256=W7kBtxYNhs3vcgMf78eIRqiTpDtqjzEI2H2d0papQ_Q,1224
13
- howler_sentinel_plugin-0.2.0.dev99.dist-info/LICENSE,sha256=Wg2luVnxEkP2NSn11nh1US6W_nFFbICBAVTG9iG3t5M,1091
14
- howler_sentinel_plugin-0.2.0.dev99.dist-info/METADATA,sha256=QZH7YTqc7odZI8KwzX9IeOU_C2quRyThuIHqiKjdyaM,748
15
- howler_sentinel_plugin-0.2.0.dev99.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
16
- howler_sentinel_plugin-0.2.0.dev99.dist-info/entry_points.txt,sha256=4IJyMY0V49s3Wp659ngN_7U8g66-czeKxI-_dNAFP5g,60
17
- howler_sentinel_plugin-0.2.0.dev99.dist-info/RECORD,,