mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 10:39:32 +01:00
fix: dot segments and doubled slashes cannot spell around the data folder refusals (release review)
The refusals of $HOME, ~/.codeman and the checkout compare strings, so `~/../me` or `<repo>/../repo/data` passed them: the first shares state with a native install, the second lands in the build context, where `COPY . .` would bake CLI logins into the image. Doubled slashes are collapsed and any `.` or `..` segment is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7ada939182
commit
f41e0cc6d4
2 files changed
+24
No files matched your search
@@ -230,6 +230,9 @@ accept_appdata_path() {
|
||||
'~') p=$HOME ;;
|
||||
'~/'*) p="$HOME/${p#\~/}" ;;
|
||||
esac
|
||||
while [[ "$p" == *//* ]]; do
|
||||
p=${p//\/\//\/}
|
||||
done
|
||||
while [[ "$p" == */ && "$p" != / ]]; do
|
||||
p=${p%/}
|
||||
done
|
||||
@@ -247,6 +250,14 @@ accept_appdata_path() {
|
||||
printf ' Use an absolute path, one that starts with /.\n' >&2
|
||||
return 1
|
||||
fi
|
||||
# The refusals below compare strings, so a dot segment could spell any folder
|
||||
# they exist to keep out.
|
||||
case "$p/" in
|
||||
*/./* | */../*)
|
||||
printf ' Spell the path out, without . or .. in it.\n' >&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
# The folder becomes the container's home directory, so its `.codeman` is
|
||||
# the server's state directory: $HOME itself would share state.json with a
|
||||
# Codeman installed directly on this machine.
|
||||
|
||||
Reference in new issue
Block a user