Add generic JSON import module (generic_json_import)#781
Draft
adulau wants to merge 2 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
misp_standardoutput.Description
misp_modules/modules/import_mod/generic_json_import.pythat fetches remote JSON, validates URLs, streams with a 20 MB guard, and parses the content.MISPObject(...).misp_objects_pathand heuristically matching flattened JSON records to templates using alias and inferred value-type scoring.MISPObjectinstances appended to aMISPEventand optionally create standalone attributes for recognised indicator values that were not mapped to an object.userConfigoptions:timeout,max_records, andinclude_unmapped_attributes, and include unit tests intests/test_generic_json_import.pycovering object mapping and fallback attribute import.Testing
python -m compileall -q misp_modules/modules/import_mod/generic_json_import.py tests/test_generic_json_import.pysucceeded.python -m black --check misp_modules/modules/import_mod/generic_json_import.py tests/test_generic_json_import.pysucceeded after formatting.pytest -q tests/test_generic_json_import.pypassed (new module tests).pytest -q tests/test.py::TestModules::test_introspection_module_structurefailed due to an existing test-suite issue (an unrelated modulemisp_modules.modules.export_modlacks an expected__all__attribute), not caused by the new module.Codex Task