fix: add element name validation to prevent path traversal#18
Draft
Koan-Bot wants to merge 1 commit intocern-mig:masterfrom
Draft
fix: add element name validation to prevent path traversal#18Koan-Bot wants to merge 1 commit intocern-mig:masterfrom
Koan-Bot wants to merge 1 commit intocern-mig:masterfrom
Conversation
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>
4 tasks
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.
Summary
_check_element()from Normal.pm to Queue.pm base class for reuseget(),get_ref(),get_path(),lock(),unlock(),touch(),remove()touch()methodMotivation
Simple.pm had no input validation on element names passed to its methods. A crafted element name like
../../etc/passwdcould be used to read or manipulate files outside the queue directory. Normal.pm already validated in most methods but was missing it intouch().By moving
_check_element()to the base Queue.pm class, both implementations share the same validation logic.Test plan
Supersedes #11 (which was polluted with unrelated commits from fork infrastructure).
🤖 Generated with Claude Code