MihaiBojin / waf-downloader

Web Application Firewall log downloader
Apache License 2.0
0 stars 0 forks source link

Handle overflow edge case #3

Closed MihaiBojin closed 1 week ago

MihaiBojin commented 5 months ago

The following code in cloudflare_waf.py does not handle one edge case last_event==intended_end_time && overflown

Add extra logic to start from last_event/intended_end_time, go a few seconds into the future, and insert logs (leaving the DB to handle duplicates)

    return LogResult(
        # This does not account for the edge case that the last event is exactly at the limit
        # TODO(): Add extra logic to check this case
        overflown=len(result) == MAX_LOG_LIMIT,
        last_event=iso_to_datetime(result[-1].datetime),
        intended_end_time=end_time,
    )