]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
fetch: handle bare file urls not ending in .rules
authorJason Ish <jason.ish@oisf.net>
Thu, 29 Feb 2024 15:40:13 +0000 (09:40 -0600)
committerJason Ish <jason.ish@oisf.net>
Tue, 5 Mar 2024 19:13:22 +0000 (13:13 -0600)
If a URL is a bare file, and does not end in .rules, Suricata-Update
will ignore it.  Such URLs might look like:

- https://<misp>/1011

Ticket: #3664

CHANGELOG.md
suricata/update/main.py

index 0e723954f5479a6ff949156fe16a63a90d43ff42..71f7d7f8eab3052ab0bec64d6a53ebc6fa71861a 100644 (file)
@@ -5,6 +5,8 @@
   https://redmine.openinfosecfoundation.org/issues/6777
 - If no Suricata is found, Suricata-Update will assume version 6.0.0
   instead of 4.0.0.
+- Handle URLs of bare files that don't end in .rules:
+  https://redmine.openinfosecfoundation.org/issues/3664
 
 ## 1.3.0 - 2023-07-07
 
index 9c29b1c5be3c2938d28a64fb0534893ba2a2953a..9d2e36d1adf164a467b9d7a1da4f852b8d80ae42 100644 (file)
@@ -235,6 +235,8 @@ class Fetch:
 
         # The file is not an archive, treat it as an individual file.
         basename = os.path.basename(filename).split("-", 1)[1]
+        if not basename.endswith(".rules"):
+            basename = "{}.rules".format(basename)
         files = {}
         files[basename] = open(filename, "rb").read()
         return files