Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wbnod opened this issue Oct 27, 2021 · 0 comments · May be fixed by #229
Open

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

wbnod opened this issue Oct 27, 2021 · 0 comments · May be fixed by #229

Comments

@wbnod
Copy link

wbnod commented Oct 27, 2021

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
wbnod referenced this issue in wbnod/atomic-threat-coverage Oct 27, 2021
try/except block around DN keys append
@wbnod wbnod linked a pull request Oct 27, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant