briandelmsft / STAT-Function

Azure Function for the Microsoft Sentinel Triage AssistanT (STAT)
https://aka.ms/mstat
MIT License
9 stars 1 forks source link

[BUG] Base Module - Fails when host entity has no DNS domain name #20

Closed briandelmsft closed 1 year ago

briandelmsft commented 1 year ago

BaseModule fails to enrich host entity when there's no dnsDomain property

{
    "statusCode": 400,
    "headers": {
        "Transfer-Encoding": "chunked",
        "Date": "Mon, 10 Jul 2023 14:51:09 GMT",
        "Content-Type": "application/json",
        "Content-Length": "905"
    },
    "body": {
        "Error": "Module processing failed, an unknown exception has occurred.",
        "InvocationId": "",
        "Traceback": [
            "Traceback (most recent call last):\n",
            "  File \"/home/site/wwwroot/modules/__init__.py\", line 19, in main\n    return_data = coordinator.initiate_module(module_name=module_name, req_body=req_body)\n",
            "  File \"/home/site/wwwroot/shared/coordinator.py\", line 9, in initiate_module\n    return_data = base.execute_base_module(req_body)\n",
            "  File \"/home/site/wwwroot/modules/base.py\", line 29, in execute_base_module\n    enrich_hosts(entities)\n",
            "  File \"/home/site/wwwroot/modules/base.py\", line 326, in enrich_hosts\n    base_object.add_host_entity(fqdn=host_name + '.' + domain_name, hostname=host_name, dnsdomain=domain_name, mdedeviceid=mde_device_id, rawentity=raw_entity)\n",
            "TypeError: can only concatenate str (not \"NoneType\") to str\n"
        ]
    }
}