[OISF/outreachy] Bug #2867 Error

Jason Ish jason.ish at oisf.net
Thu Mar 14 21:03:26 UTC 2019


Hi Vrinda,

I'd probably add a new unit test in tests/test_rule.py, something like
this should do:

    def test_parse_no_sid(self):
        """Test parsing a rule with no sid."""
        rule_string = u"""alert ip any any -> any any
(content:"uid=0|28|root|29|"; classtype:bad-unknown;)"""
        rule = suricata.update.rule.parse(rule_string)
        self.assertEqual(0, rule.id)

Jason

On 2019-03-14 2:21 p.m., Vrinda Narayan via Outreachy wrote:
> Hey,
> Can someone help me recreate this error?
> Link : https://redmine.openinfosecfoundation.org/issues/2867
> 
> If someone by mistake forgets a semicolon or changes a rule to not have
> a gid or sid, it leads to the following error:
> 
> |Traceback (most recent call last): File "/bin/suricata-update", line
> 33, in <module> sys.exit(main.main()) File
> "/bin/../lib/python3.4/site-packages/suricata/update/main.py", line
> 1454, in main sys.exit(_main()) File
> "/bin/../lib/python3.4/site-packages/suricata/update/main.py", line
> 1334, in _main rulemap = build_rule_map(rules) File
> "/bin/../lib/python3.4/site-packages/suricata/update/main.py", line 696,
> in build_rule_map if rule.id not in rulemap: File
> "/bin/../lib/python3.4/site-packages/suricata/update/rule.py", line 121,
> in id return (int(self.gid), int(self.sid)) TypeError: int() argument
> must be a string, a bytes-like object or a number, not 'NoneType'|
> 
> Regards
> Vrinda Narayan
> 
> _______________________________________________
> Outreachy mailing list
> Outreachy at lists.openinfosecfoundation.org
> https://lists.openinfosecfoundation.org/listinfo/outreachy
> 


More information about the Outreachy mailing list