Add reset combinator
This commit is contained in:
parent
7720833ef4
commit
98a6bd032c
4 changed files with 53 additions and 0 deletions
|
|
@ -213,6 +213,29 @@ spec = parallel $ inTestM $ do
|
|||
])
|
||||
|]
|
||||
|
||||
describe "reset" $ do
|
||||
it "clears all set permissions - including ones set in base permissions" $ do
|
||||
[i|
|
||||
let
|
||||
jail' = jail-nix.extend {
|
||||
inherit pkgs;
|
||||
basePermissions = c: [
|
||||
c.base
|
||||
(c.readonly "/nix/store")
|
||||
(c.write-text "/test-from-base-permissions" "")
|
||||
];
|
||||
};
|
||||
in
|
||||
jail' "test" (sh "echo /test-from-*") (c: [
|
||||
(c.write-text "/test-from-pre-reset-jail-permissions" "")
|
||||
c.reset
|
||||
c.base
|
||||
(c.readonly "/nix/store")
|
||||
(c.write-text "/test-from-post-reset-jail-permissions" "")
|
||||
])
|
||||
|]
|
||||
`shouldOutput` "/test-from-post-reset-jail-permissions\n"
|
||||
|
||||
describe "set-argv" $ do
|
||||
it "overrides argv passed to the jailed program" $ do
|
||||
[i|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue