Skip to content

Conversation

@anushka-codes1
Copy link

Fixes #39

Problem

Setting an interval ("repeat every") value of "0" in the recurrence popup causes an infinite loop in Python dateutil RRULE interpretation, hanging the server.

Root Cause

  • INTERVAL=0 is not a valid value per RFC 5545
  • python-dateutil enters an infinite loop when iterating over such rules
  • The frontend mockup has validation for this, but server-side validation was missing

Solution

Added server-side validation in json_recurrence.py to:

  • Detect RRULE strings containing INTERVAL=0 or negative values using regex
  • Return HTTP 400 with the existing translated error message no_repeat_every
  • Prevent the infinite loop by rejecting invalid intervals before calling rrule.rrulestr()

Testing

  • Syntax check passed with python -m py_compile
  • Manual testing: POST to @@json_recurrence with INTERVAL=0 now returns 400 + error message instead of hanging

Example

Before: FREQ=MONTHLY;INTERVAL=0;BYMONTHDAY=1;COUNT=7 → infinite loop
After: Same RRULE → HTTP 400 with translated error message

Files Changed

  • src/plone/formwidget/recurrence/browser/json_recurrence.py - Added validation logic
  • news/interval-validation.bugfix - Towncrier changelog entry

Fixes plone#39

- Add server-side validation to reject RRULE strings with INTERVAL=0 or negative values
- INTERVAL=0 is invalid per RFC 5545 and causes infinite loops in python-dateutil
- Return HTTP 400 with translated 'no_repeat_every' error message
- Prevents server hangs when users set repeat interval to 0 in the UI
@mister-roboto
Copy link

@anushka-codes1 thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

- Fix import order (isort)
- Add newline at end of news fragment file
@anushka-codes1
Copy link
Author

@jenkins-plone-org please run jobs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User can cause infinite loop with recurrence widget

2 participants