aboutsummaryrefslogtreecommitdiff
blob: 10e8723daa64e393a184aa13ce136f029842d1f7 (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
#!/bin/sh
# make sure we cannot break out via a symlink in a dir that is
# otherwise not readable as non-root

[ ${SB_UID} -eq 0 ] && exit 77

addwrite $PWD

chmod -R a+rwx base 2>/dev/null
rm -rf base

set -e

mkdir -p base/d
cd base/d
chmod a-r .
chmod a-rx ..
ln -s / root

# this should trigger a sb violation
unset SANDBOX_PREDICT
(mkdir-0 -1 root/aksdfjasdfjaskdfjasdfla 0777)

chmod a+rx ..
chmod a+r .

test -s "${SANDBOX_LOG}"

exit 0