PerlDancer / PerlDancer/Dancer2
Route::_check_options interpolates the option name into a regex
Open
Beginner friendly
Nobody has claimed this yet.
Bug
- Dominant language
- Perl
- Stars
- 604
- Forks
- 288
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 5
Description
Status: reasoned from code
lib/Dancer2/Core/Route.pm:63:
croak "Not a valid option for route matching: `$opt'"
if not( grep {/^$opt$/} @supported_options );
$opt is a hash key interpolated straight into a pattern.
Impact
- An option named
.matches every supported option and defeats the validation entirely. - An option containing regex metacharacters dies with a regex compile error instead of the intended message.
- It recompiles a pattern per option per route.
Developer-supplied rather than request-supplied, so this is correctness rather than security.
Suggested fix
if ( not grep { $_ eq $opt } @supported_options ) {
Strictly better and faster.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at lib/Dancer2/Core/Route.pm:63 and inspect how _check_options validates each route option. Replace the regex-based comparison with literal option-name matching, then verify that valid options still pass and invalid or regex-like names produce the intended validation error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- perl
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100