Skip to content

es-index-export.py does not handle missing fields in DN #228

Open
@wbnod

Description

@wbnod

Script for exporting Elastic index, atomic-threat-coverage/scripts/es-index-export.py breaks when executing Makefile because some data/atc/data_needed/DN_### files are missing required keys, e.g. 'provider:'.

error line 258 in __init__:
if dn['provider'] not in dn_providers:
KeyError: 'provider'

Best case solution is if upstream DN_files are correctly formed with all needed keys present. Since we cannot guarantee that, es-export-index.py needs to provide some level of resilience rather than failing altogether.

Workaround is to wrap block in try/except for error handling. Likely needed for other blocks as well.

try:
    for dn in alert_dns:
        ...
except:
    pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions