gnodet commented on PR #30673:
URL: https://github.com/apache/camel/pull/30673#issuecomment-7107463321

   Thanks for the careful review @davsclaus — both blocking points were valid 
and have been addressed.
   
   **Point 1 — leading ``..`` on relative paths (the core bug):** The original 
code dropped an unresolvable ``..`` for relative paths when the stack was 
empty; `../secret.txt` incorrectly became `secret.txt`. Fixed in commit 
52ee6cd: the `".."` branch now distinguishes absolute from relative paths. For 
relative paths, ``..`` is pushed onto the stack when it is empty or its top is 
already ``..``, preserving all leading ``..`` segments so that 
`isWithinDirectory` can reject them. The existing 
`shouldRejectUpwardsPathsWhenPollingTheSessionRoot` assertion now passes 
correctly.
   
   **Point 2 — session-root gap with URI-scheme-like paths:** With point 1 
fixed, `http:/../etc/passwd` normalizes to `../../etc/passwd` (the `http:` 
segment resolves the first ``..``, leaving one unresolvable ``..``). 
`isWithinDirectory` correctly rejects this for both a non-empty directory and 
the session root (empty directory). New test 
`isWithinStartingDirectorySessionRootRejectsUpwardPaths` covers the 
session-root rejection for `../secret.txt`, `../../etc/passwd`, and their 
backslash equivalents.
   
   _Claude Code on behalf of gnodet_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to