howler-sentinel-plugin 0.1.0.dev11__py3-none-any.whl → 0.1.0.dev14__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.1.0.dev11
3
+ Version: 0.1.0.dev14
4
4
  Summary: A howler plugin for integration with Microsoft's Sentinel API
5
5
  License: MIT
6
6
  Author: CCCS
@@ -2,9 +2,9 @@ sentinel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  sentinel/odm/hit.py,sha256=hAuO2ONMK3Ml8Xu6E7tHrmZ7M6HG5tT38RD9ZxwY254,666
3
3
  sentinel/odm/models/sentinel.py,sha256=XT3XdT92uoCV5vmY9dT1jmcxRyuu9vp1gE8AwZdKBIc,337
4
4
  sentinel/routes/__init__.py,sha256=JYmKRwIfEsiPos1XuMQ2mlGDbxk6TN_cVEM0K_RNze4,130
5
- sentinel/routes/ingest.py,sha256=W5YcY2Es7WrOsaABOEMDPVe-4UkMw43mjI7h91nRTTQ,678
6
- howler_sentinel_plugin-0.1.0.dev11.dist-info/LICENSE,sha256=Wg2luVnxEkP2NSn11nh1US6W_nFFbICBAVTG9iG3t5M,1091
7
- howler_sentinel_plugin-0.1.0.dev11.dist-info/METADATA,sha256=ZNWZ5Rl1oyA1G3rfailXoItqeCqLHZv33Juxds57nEI,694
8
- howler_sentinel_plugin-0.1.0.dev11.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
9
- howler_sentinel_plugin-0.1.0.dev11.dist-info/entry_points.txt,sha256=4IJyMY0V49s3Wp659ngN_7U8g66-czeKxI-_dNAFP5g,60
10
- howler_sentinel_plugin-0.1.0.dev11.dist-info/RECORD,,
5
+ sentinel/routes/ingest.py,sha256=P6jgTJmuCLrF3_mrZwzm7Fn2k4TNJCmYOte3hIKT0js,1069
6
+ howler_sentinel_plugin-0.1.0.dev14.dist-info/LICENSE,sha256=Wg2luVnxEkP2NSn11nh1US6W_nFFbICBAVTG9iG3t5M,1091
7
+ howler_sentinel_plugin-0.1.0.dev14.dist-info/METADATA,sha256=ACM6cCUGCWsH-5E9QvamOgNk5rkGLzscIWT_4Er80Tw,694
8
+ howler_sentinel_plugin-0.1.0.dev14.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
9
+ howler_sentinel_plugin-0.1.0.dev14.dist-info/entry_points.txt,sha256=4IJyMY0V49s3Wp659ngN_7U8g66-czeKxI-_dNAFP5g,60
10
+ howler_sentinel_plugin-0.1.0.dev14.dist-info/RECORD,,
sentinel/routes/ingest.py CHANGED
@@ -1,5 +1,8 @@
1
+ import os
2
+ import re
3
+
1
4
  from flask import request
2
- from howler.api import make_subapi_blueprint, ok
5
+ from howler.api import make_subapi_blueprint, ok, unauthorized
3
6
  from howler.common.logging import get_logger
4
7
  from howler.common.swagger import generate_swagger_docs
5
8
 
@@ -9,6 +12,8 @@ sentinel_api._doc = "Interact with spellbook"
9
12
 
10
13
  logger = get_logger(__file__)
11
14
 
15
+ SECRET = os.environ["SENTINEL_LINK_KEY"]
16
+
12
17
 
13
18
  @generate_swagger_docs()
14
19
  @sentinel_api.route("/ingest", methods=["POST"])
@@ -23,6 +28,12 @@ def ingest_alert(**kwargs):
23
28
 
24
29
  Result Example:
25
30
  """
31
+ if apikey := request.headers.get("Authorization", "Basic ", type=str).split(" ")[1]:
32
+ logger.info("Recieved authorization header with value %s", re.sub(r"^(.{3}).+(.{3})$", r"\1...\2", apikey))
33
+
34
+ if apikey != SECRET:
35
+ return unauthorized(err="API Key does not match expected value.")
36
+
26
37
  sentinel_alert = request.json
27
38
 
28
39
  logger.info("Sentinel Alert:\n%s", sentinel_alert)