max_vevent_rrule_occurrence: change loglevel, align test ics name

This commit is contained in:
Peter Bieringer
2026-08-02 15:12:48 +02:00
parent e430e7984c
commit 432a599a13
3 changed files with 8 additions and 8 deletions

View File

@@ -257,7 +257,7 @@ def check_and_sanitize_items(
raise ValueError("Too many recurrence rule entries in %s in object %r: %d (limit: %d)"
% (component.name, component_uid, rrule_count, max_vevent_rrule_occurrence))
else:
logger.trace("Recurrence rule count in %s in object %r: %d (PASSED/limit: %d)" % (component.name, component_uid, rrule_count, max_vevent_rrule_occurrence))
logger.debug("Recurrence rule count in %s in object %r: %d (PASSED/limit: %d)" % (component.name, component_uid, rrule_count, max_vevent_rrule_occurrence))
if hasattr(component, "dtstart"):
# early check of maximum of (UNTIL-DTSTART)/interval(FREQ) to avoid DoS (ugly workaround with some guessing)
pattern = re.compile('FREQ=([A-Z]+)(;.*)?$')
@@ -281,8 +281,8 @@ def check_and_sanitize_items(
seconds = delta.total_seconds()
if seconds < 0:
# UNTIL < DTSTART
logger.error("Recurrence rule %r in %s in object %r REJECTED, UNTIL is in the past", component.rrule.value, component.name, component_uid)
raise ValueError("Recurrence rule in %s in object %r has UNTIL in the past"
logger.error("Recurrence rule %r in %s in object %r REJECTED, UNTIL < DTSTART", component.rrule.value, component.name, component_uid)
raise ValueError("Recurrence rule in %s in object %r has UNTIL < DTSTART"
% (component.name, component_uid))
rrule_entries = seconds / RRULE_FREQUENCIES_TO_INTERVAL[freq]
logger.trace("estimated rule entries: %d", rrule_entries)
@@ -291,7 +291,7 @@ def check_and_sanitize_items(
raise ValueError("Too many recurrence rule entries in %s in object %r: %d (limit: %d)"
% (component.name, component_uid, rrule_entries, max_vevent_rrule_occurrence))
else:
logger.trace("Recurrence rule %r entries in %s in object %r: %d (estimated/PASSED/limit: %d)" % (component.rrule.value, component.name, component_uid, rrule_entries, max_vevent_rrule_occurrence))
logger.debug("Recurrence rule %r entries in %s in object %r: %d (estimated/PASSED/limit: %d)" % (component.rrule.value, component.name, component_uid, rrule_entries, max_vevent_rrule_occurrence))
# generic check by vobject
try:
rruleset = component.rruleset
@@ -311,7 +311,7 @@ def check_and_sanitize_items(
raise ValueError("Too many recurrence rule entries in %s in object %r: %d (limit: %d)"
% (component.name, component_uid, rrule_entries, max_vevent_rrule_occurrence))
else:
logger.trace("Recurrence rule %r entries in %s in object %r: %d (calculated/PASSED/limit: %d)", component.rrule.value, component.name, component_uid, rrule_entries, max_vevent_rrule_occurrence)
logger.debug("Recurrence rule %r entries in %s in object %r: %d (calculated/PASSED/limit: %d)", component.rrule.value, component.name, component_uid, rrule_entries, max_vevent_rrule_occurrence)
elif tag == "VADDRESSBOOK":
# https://tools.ietf.org/html/rfc6352#section-5.1
object_uids = set()

View File

@@ -356,10 +356,10 @@ permissions: RrWw""")
event = get_file_content("event_full_day_rrule_until_2y.ics")
self.put("/calendar.ics/event.ics", event, check=400)
def test_add_event_with_rrule_until_in_the_past(self) -> None:
"""Test event with RRULE UNTIL=in-the-past."""
def test_add_event_with_rrule_until_before_dtstart(self) -> None:
"""Test event with RRULE UNTIL < DTSTART."""
self.mkcalendar("/calendar.ics/")
event = get_file_content("event_full_day_rrule_until_in_the_past.ics")
event = get_file_content("event_full_day_rrule_until_before_dtstart.ics")
self.put("/calendar.ics/event.ics", event, check=400)
def test_add_event_with_rrule_until_50y_limit_100(self) -> None: