Skip to content

fix: three minor bugs in Context, Filters, and Provider#425

Open
toddr-bot wants to merge 2 commits into
mainfrom
koan.toddr.bot/fix-minor-bugs
Open

fix: three minor bugs in Context, Filters, and Provider#425
toddr-bot wants to merge 2 commits into
mainfrom
koan.toddr.bot/fix-minor-bugs

Conversation

@toddr-bot

Copy link
Copy Markdown
Contributor

What

Fix four bugs across Context.pm, Filters.pm, Provider.pm, and Stash.pm.

Why

  • Provider.pm: _load_compiled() error message uses $compiled (undef on failure) instead of $fpath, causing "uninitialized value" warnings (relates to GH Strange bug not sure the cause #280).
  • Context.pm: join(', ') in debug output for process() and insert() is missing its list argument.
  • Filters.pm: Redirect filter .. traversal check only matched ../ with trailing slash. Bare .., foo/.., and Windows ..\\ bypassed it.
  • Stash.pm: _assign() used hash access $root->{ $item } instead of array access $root->[$item] when checking DEFAULT on list elements. This caused DEFAULT to always overwrite array values.

How

  • Provider: $compiled$fpath in error string.
  • Context: join(', ')join(', ', @$template) / join(', ', @$files).
  • Filters: Regex (^|/)\.\./(^|[\\/])\.\.([\\/]|$).
  • Stash: $root->{ $item }$root->[$item] in the ARRAY branch of _assign().

Testing

  • 3 new redirect path traversal tests in t/filter.t
  • 2 new DEFAULT-on-array tests in t/vars.t
  • Full suite: 3180 tests across 116 files, all passing.

🤖 Generated with Claude Code

@toddr-bot

Copy link
Copy Markdown
Contributor Author

Recreated from #371 (auto-closed when the toddr-bot fork was removed). Original branch is now hosted on this repo.

@toddr

toddr commented May 24, 2026

Copy link
Copy Markdown
Member

@toddr-bot rebase

toddr-bot and others added 2 commits May 24, 2026 20:33
1. Provider::_load_compiled error message used $compiled (undef on
   failure) instead of $fpath, causing "uninitialized value" warnings.

2. Context::process() and insert() debug calls had join(', ') with no
   list argument — the template names were passed as separate args to
   debug() instead of being comma-joined.

3. Redirect filter path traversal check only caught '../' with trailing
   slash. Now also catches '..' alone, 'foo/..' without trailing slash,
   and Windows-style backslash separators.

Added 3 test cases for redirect path traversal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The _assign() method in Stash.pm used hash access ($root->{ $item })
instead of array access ($root->[$item]) when checking if a list element
already has a value for the DEFAULT directive. This meant DEFAULT on
array indices would always overwrite instead of preserving existing
values, because $root->{ $item } on an arrayref doesn't find the
existing value.

Added tests for DEFAULT on array elements (existing and new indices).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@toddr-bot

Copy link
Copy Markdown
Contributor Author

Rebase with requested adjustments

Branch koan.toddr.bot/fix-minor-bugs was rebased onto main and review feedback was applied.

Stats

3 files changed, 52 insertions(+), 3 deletions(-)
Actions performed
  • Already-solved check: skipped (Claude call failed)
  • Resolved merge conflicts (1 round(s))
  • Rebased koan.toddr.bot/fix-minor-bugs onto origin/main
  • Pre-push CI check: previous run passed
  • Force-pushed koan.toddr.bot/fix-minor-bugs to origin
  • CI check enqueued in ## CI (async)

CI status

CI will be checked asynchronously.


Automated by Kōan

@toddr-bot toddr-bot force-pushed the koan.toddr.bot/fix-minor-bugs branch from 44dfea0 to 2dbc70a Compare May 24, 2026 20:34
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.

2 participants