Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions test/landlock_capture_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,31 @@ def test_capture_seccomp_denies_network
assert_equal "denied", result.stdout
end

def test_capture_seccomp_denies_udp_socket
skip "Landlock unsupported" unless Landlock.supported?

result =
Landlock.capture(
[
RbConfig.ruby,
"--disable=gems",
"-rsocket",
"-e",
"begin; Socket.new(:INET, :DGRAM); rescue Errno::EPERM; print 'denied'; end"
],
read: runtime_paths,
execute: runtime_paths,
env: {
"PATH" => ENV.fetch("PATH", "")
},
unsetenv_others: true,
seccomp_deny_network: true
)

assert result.status.success?, result.stderr
assert_equal "denied", result.stdout
end

def test_capture_custom_path_rule_allows_read
skip "Landlock unsupported" unless Landlock.supported?

Expand Down
Loading