Fix issue #282: Detect large date ranges in aggregate reports and skip processing (#408)

This commit is contained in:
Michael Kliewe
2023-05-15 00:06:07 +02:00
committed by GitHub
parent d426098b7e
commit af1e299dd4

View File

@@ -264,6 +264,8 @@ def parse_aggregate_report_xml(xml, ip_db_path=None, offline=False,
"").replace(">", "").split("@")[0]
new_report_metadata["report_id"] = report_id
date_range = report["report_metadata"]["date_range"]
if (int(date_range["end"]) - int(date_range["begin"]) > 2*86400):
raise InvalidAggregateReport("The begin and end fields span too many hours, should be max 24 hours according to RFC 7489 section 7.2")
date_range["begin"] = timestamp_to_human(date_range["begin"])
date_range["end"] = timestamp_to_human(date_range["end"])
new_report_metadata["begin_date"] = date_range["begin"]