From: Jason Ish Date: Wed, 23 Nov 2022 22:47:35 +0000 (-0600) Subject: source: better error if source spec missing "source" keyword X-Git-Tag: 1.3.0rc1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22caef26ec0f08288bb5bcc856ed87414c7ad4b4;p=thirdparty%2Fsuricata-update.git source: better error if source spec missing "source" keyword Related ticket: #5141 --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d0e7ae..b60d3d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ https://redmine.openinfosecfoundation.org/issues/3974 - Allow spaces in custom HTTP headers. Redmine issue https://redmine.openinfosecfoundation.org/issues/4362 +- Better error message on invalid source specification: + https://redmine.openinfosecfoundation.org/issues/5141 ## 1.2.5 - 2022-09-22 - Update entrypoint search path when not installed with distutils. This is diff --git a/suricata/update/sources.py b/suricata/update/sources.py index 651a4d6..a5bc673 100644 --- a/suricata/update/sources.py +++ b/suricata/update/sources.py @@ -158,7 +158,14 @@ def get_enabled_sources(): for filename in filenames: if filename.endswith(".yaml"): path = os.path.join(dirpath, filename) + logger.debug("Loading source specification file {}".format(path)) source = yaml.safe_load(open(path, "rb")) + + if not "source" in source: + logger.error("Source specification file missing field \"source\": filename: {}".format( + path)) + continue + sources[source["source"]] = source if "params" in source: