mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-12 23:29:16 +03:00
test(docker): run bwrap check as final user
Co-authored-by: yu-xin-c <175149126+yu-xin-c@users.noreply.github.com>
This commit is contained in:
@@ -214,11 +214,17 @@ jobs:
|
|||||||
INNER
|
INNER
|
||||||
OUTER
|
OUTER
|
||||||
docker compose -f docker-compose.yml -f docker-compose.bwrap.yml \
|
docker compose -f docker-compose.yml -f docker-compose.bwrap.yml \
|
||||||
run --rm --no-deps -T --entrypoint sh nanobot-cli -s <<'BWRAP'
|
run --rm --no-deps -T --user nanobot --entrypoint sh nanobot-cli -s <<'BWRAP'
|
||||||
set -eu
|
set -eu
|
||||||
|
field() {
|
||||||
|
awk -v key="$1:" '$1 == key { print $2 }' /proc/self/status
|
||||||
|
}
|
||||||
|
test "$(id -u)" = "1000"
|
||||||
|
test "$(field NoNewPrivs)" = "1"
|
||||||
|
for capability_set in CapInh CapPrm CapEff CapAmb; do
|
||||||
|
test "$(field "$capability_set")" = "0000000000000000"
|
||||||
|
done
|
||||||
mkdir -p /home/nanobot/.nanobot/workspace
|
mkdir -p /home/nanobot/.nanobot/workspace
|
||||||
chown -R nanobot:nanobot /home/nanobot/.nanobot
|
|
||||||
setpriv --reuid=nanobot --regid=nanobot --init-groups \
|
|
||||||
bwrap --new-session --die-with-parent \
|
bwrap --new-session --die-with-parent \
|
||||||
--ro-bind /usr /usr \
|
--ro-bind /usr /usr \
|
||||||
--ro-bind-try /bin /bin \
|
--ro-bind-try /bin /bin \
|
||||||
|
|||||||
Reference in New Issue
Block a user