-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Working on unveil support * Fix spelling mistake * Remove check when expecting failure * Use Nim v1.0.0 for CI * Always trigger email, revert to Nim 0.20.2 as 1.0.0 is failing to compile
- Loading branch information
1 parent
5a516b4
commit 5935629
Showing
7 changed files
with
104 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,5 @@ tasks: | |
env PATH="$HOME/nim-${NIM_VERSION}/bin:$PATH" nim c --cc:clang -r tests/main.nim | ||
triggers: | ||
- action: email | ||
condition: failure | ||
condition: always | ||
to: Euan T <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
Example of making a single promise pledge.html#example-of-making-a-single-promise Example of making a single promise | ||
Example of making several promises pledge.html#example-of-making-several-promises Example of making several promises | ||
Promise pledge.html#Promise pledge: Promise | ||
Permission pledge.html#Permission pledge: Permission | ||
pledge pledge.html#pledge,Option[string],Option[string] pledge: pledge(promises: Option[string]; execPromises: Option[string] = none(string)) | ||
unveil pledge.html#unveil,Option[string],Option[string] pledge: unveil(path: Option[string]; permissions: Option[string]) | ||
pledge pledge.html#pledge.t,varargs[Promise] pledge: pledge(promises: varargs[Promise]) | ||
unveil pledge.html#unveil.t,string,set[Permission] pledge: unveil(path: string; permissions: set[Permission]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,31 @@ | ||
import pledge, unittest, os | ||
|
||
suite "unveil tests": | ||
test "can access path that is unveiled": | ||
unveil("/dev/urandom", {Permission.Read}) | ||
|
||
var f: File | ||
check open(f, "/dev/urandom", fmRead) | ||
var buff: array[0..9, byte] | ||
check f.readBytes(buff, 0, len(buff)) > 0 | ||
|
||
when defined(openbsd): | ||
test "can't access path that isn't unveiled": | ||
unveil("/dev/urandom", {Permission.Read}) | ||
unveil("", {}) | ||
|
||
var f: File | ||
check not open(f, "/dev/zero", fmRead) | ||
|
||
suite "pledge tests": | ||
test "can pledge": | ||
pledge(Promise.Stdio, Promise.Rpath) | ||
pledge(Promise.Stdio, Promise.Rpath, Promise.Unveil) | ||
|
||
check true | ||
|
||
when defined(openbsd): | ||
test "can not elevate": | ||
pledge(Promise.Stdio) | ||
pledge(Promise.Stdio, Promise.Unveil) | ||
|
||
expect OSError: | ||
pledge(Promise.Stdio, Promise.Rpath) | ||
pledge(Promise.Stdio, Promise.Rpath, Promise.Unveil) |