blob: 8dc8fc32206875a6bc842c3215f1c1280533cf23 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
if [ -n "$CLAUDECODE" ]; then
# Safe wrapper for find command
find() {
has_dangerous=0
for arg in "$@"; do
case "$arg" in
-delete|-exec|-execdir|-fls|-fprint|-fprint0|-fprintf|-ok|-okdir)
has_dangerous=1
break
;;
esac
done
if [ $has_dangerous = 1 ]; then
echo "Error: dangerous actions, -delete/-exec/-execdir/-fls/-fprint/-fprint0/-fprintf/-ok/-okdir, are not allowed in Claude Code environment" >&2
return 1
fi
command find "$@"
}
# Safe wrapper for fd command
fd() {
has_dangerous=0
for arg in "$@"; do
case "$arg" in
-x|--exec|-X|--exec-batch)
has_dangerous=1
break
;;
esac
done
if [ $has_dangerous = 1 ]; then
echo "Error: dangerous actions, -x/--exec/-X/--exec-batch, are not allowed in Claude Code environment" >&2
return 1
fi
command fd "$@"
}
fi
|