Bound Repeatable counter_name to prevent CPU/memory DoS (CVE-2026-19873) - #72
Open
djzort wants to merge 1 commit into
Open
Bound Repeatable counter_name to prevent CPU/memory DoS (CVE-2026-19873)#72djzort wants to merge 1 commit into
djzort wants to merge 1 commit into
Conversation
Add max_counter attribute to Repeatable elements that caps the client-supplied repeat count from the query string. Default is 100, inherited from a new form-level repeatable_max_counter attribute. Additional hardening beyond the base patch: - counter_clamped read-only flag signals when clamping occurred - max_counter=0 means unlimited (safer than undef escape hatch) - Form-level repeatable_max_counter sets the default for all Repeatable elements in the form
There was a problem hiding this comment.
Pull request overview
This PR hardens HTML::FormFu::Element::Repeatable against CPU/memory DoS by bounding the client-supplied repeat count (from the query param named by counter_name) and adding a form-level default for that bound.
Changes:
- Add
max_countertoRepeatable(defaulting to form-levelrepeatable_max_counter, otherwise 100) and clamp the query-driven repeat count to that maximum. - Add
counter_clampedread-only flag to indicate clamping occurred during the most recentprocess. - Add regression tests and config covering default clamping, override behavior, unlimited mode (
0), and form-level default inheritance.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| t/repeatable/max_counter.yml | Adds a minimal Repeatable config used by the new max-counter test suite. |
| t/repeatable/max_counter.t | Adds tests validating clamping behavior, unlimited mode, inheritance, and chaining. |
| lib/HTML/FormFu/Element/Repeatable.pm | Implements max_counter/counter_clamped and clamps query-driven repeat counts in process. |
| lib/HTML/FormFu.pm | Adds form-level repeatable_max_counter attribute and documentation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+17
to
+26
| has max_counter => ( | ||
| is => 'rw', | ||
| default => sub { | ||
| my $form = $_[0]->form; | ||
| return $form->repeatable_max_counter if $form; | ||
| return 100; | ||
| }, | ||
| lazy => 1, | ||
| traits => ['Chained'], | ||
| ); |
Comment on lines
+114
to
+119
| has repeatable_max_counter => ( | ||
| is => 'rw', | ||
| default => 100, | ||
| lazy => 1, | ||
| traits => ['Chained'], | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add max_counter attribute to Repeatable elements that caps the client-supplied repeat count from the query string. Default is 100, inherited from a new form-level repeatable_max_counter attribute.
Additional hardening beyond the base patch: