Skip to content

Comments

fix: add element name validation to prevent path traversal#18

Draft
Koan-Bot wants to merge 1 commit intocern-mig:masterfrom
atoomic:koan.atoomic/simple-input-validation-v2
Draft

fix: add element name validation to prevent path traversal#18
Koan-Bot wants to merge 1 commit intocern-mig:masterfrom
atoomic:koan.atoomic/simple-input-validation-v2

Conversation

@Koan-Bot
Copy link

Summary

  • Move _check_element() from Normal.pm to Queue.pm base class for reuse
  • Add element name validation to all element-consuming methods in Simple.pm: get(), get_ref(), get_path(), lock(), unlock(), touch(), remove()
  • Add missing validation to Normal.pm's touch() method

Motivation

Simple.pm had no input validation on element names passed to its methods. A crafted element name like ../../etc/passwd could be used to read or manipulate files outside the queue directory. Normal.pm already validated in most methods but was missing it in touch().

By moving _check_element() to the base Queue.pm class, both implementations share the same validation logic.

Test plan

  • Existing test suite passes (237 tests)
  • Malformed element names are rejected with clear error messages

Supersedes #11 (which was polluted with unrelated commits from fork infrastructure).

🤖 Generated with Claude Code

Move _check_element() from Normal.pm to the Queue.pm base class so it
can be shared across queue implementations. Add validation calls to all
element-consuming methods in Simple.pm (get, get_ref, get_path, lock,
unlock, touch, remove) and to Normal.pm's touch() method which was
missing validation.

This prevents path traversal attacks where a crafted element name like
"../../etc/passwd" could be used to access files outside the queue
directory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant