Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter expert: unable to handle empyt-string parameters not_after & not_before #2074

Closed
ghost opened this issue Aug 27, 2021 · 0 comments
Closed
Labels
bug Indicates an unexpected problem or unintended behavior component: bots
Milestone

Comments

@ghost
Copy link

ghost commented Aug 27, 2021

If the not_after or not_before parameter is an empty string instead of null or non-existing, an error like this is raised:

filter-source-ip-exists-expert: Bot initialization failed.
Traceback (most recent call last):
  File "/dev/intelmq/intelmq/lib/bot.py", line 209, in __init__
    self.init()
  File "/dev/intelmq/intelmq/bots/experts/filter/expert.py", line 47, in init
    self.not_after = self.parse_timeattr(self.not_after)
  File "/dev/intelmq/intelmq/bots/experts/filter/expert.py", line 41, in parse_timeattr
    absolute = parser.parse(time_attr)
  File "/usr/lib/python3.8/site-packages/dateutil/parser/_parser.py", line 1368, in parse
    return DEFAULTPARSER.parse(timestr, **kwargs)
  File "/usr/lib/python3.8/site-packages/dateutil/parser/_parser.py", line 646, in parse
    raise ParserError("String does not contain a date: %s", timestr)
dateutil.parser._parser.ParserError: String does not contain a date: 

The reason is the is not None check, which does not cover empty strings. Empty strings are set by the manager of empty values.

@ghost ghost added bug Indicates an unexpected problem or unintended behavior component: bots labels Aug 27, 2021
@ghost ghost added this to the 3.0.1 milestone Aug 27, 2021
@ghost ghost self-assigned this Aug 27, 2021
ghost pushed a commit that referenced this issue Aug 27, 2021
if any of these two parameters contained empty strings, the bot
initialization failed

fixes #2074
@ghost ghost closed this as completed in 6634984 Aug 30, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior component: bots
Projects
None yet
Development

No branches or pull requests

0 participants