Skip to content

The IDMEFv2 package in TestPyPi throws errors when parsing the json schema #4

@AlyaGomaa

Description

@AlyaGomaa

Issue

msg.validate() throws the following error

Traceback (most recent call last):
  File "/home/alya/Desktop/idmef_err/repro.py", line 32, in <module>
    msg.validate()
  File "/home/alya/Desktop/idmef_err/venv/lib/python3.12/site-packages/idmefv2/message.py", line 96, in validate
    jsonschema.validate(self, json.load(stream))
                              ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 293, in load
    return loads(fp.read(),
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
               ^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 459 column 13 (char 26629)

To reproduce:

requirements.txt

idmefv2 @ https://test-files.pythonhosted.org/packages/b1/73/0a2fed6402511e28a0bb8c53f22c0fd12d77b1dc5bea233ac70b65488c4f/idmefv2-0.0.6.tar.gz

main.py

from idmefv2 import Message


msg = Message()
msg.update(
    {
        "Version": "2.0.3",
        "Analyzer": {
            "IP": "0.0.0.0",
            "Name": "Slips",
            "Model": "1.1.20",
            "Category": ["NIDS"],
            "Data": ["Flow", "Network"],
            "Method": ["Heuristic"],
        },
        "Status": "Event",
        "ID": "f7e7af55-3d4f-49c4-a2ed-969203738298",
        "Severity": "Low",
        "StartTime": "2026-05-07T21:12:49.421396+03:00",
        "CreateTime": "2026-05-07T21:14:41.608308+03:00",
        "Confidence": 0.8,
        "Description": (
            "performing an arp scan. Confidence 0.8. Threat level: low."
        ),
        "Source": [{"IP": "192.168.1.21"}],
    }
)

msg.validate()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions