Skip to content

Commit

Permalink
test: add case for GH opencontainers#2086
Browse files Browse the repository at this point in the history
Commit 5e0e67d ("fix permission denied") modified some code but
did not provide a test case.

This is a test case that was tested to fail before and succeed after
the above commit.

For more details, see opencontainers#2086

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
  • Loading branch information
kolyshkin authored and dqminh committed Feb 3, 2021
1 parent 9892eff commit d3058db
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/integration/cwd.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bats

load helpers

function setup() {
teardown_busybox
setup_busybox
}

function teardown() {
teardown_busybox
}

# Test case for https://github.com/opencontainers/runc/pull/2086
@test "runc exec --user with no access to cwd" {
requires root

chown 42 rootfs/root
chmod 700 rootfs/root

update_config ' .process.cwd = "/root"
| .process.user.uid = 42
| .process.args |= ["sleep", "1h"]'

runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
[ "$status" -eq 0 ]

runc exec --user 0 test_busybox true
[ "$status" -eq 0 ]
}

0 comments on commit d3058db

Please sign in to comment.