]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
source: better error if source spec missing "source" keyword
authorJason Ish <jason.ish@oisf.net>
Wed, 23 Nov 2022 22:47:35 +0000 (16:47 -0600)
committerJason Ish <jason.ish@oisf.net>
Thu, 24 Nov 2022 00:52:51 +0000 (18:52 -0600)
Related ticket: #5141

CHANGELOG.md
suricata/update/sources.py

index 0d0e7aef255bc84a95136a31560f2602379c1a69..b60d3d782574aa15f85d709c89eb21b3263bf779 100644 (file)
@@ -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
index 651a4d60d8125a701e5d1681425773a22bd074c7..a5bc6737ee6bd399b6c5c2d341827445e1641328 100644 (file)
@@ -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: