AssertSyscall 0.1.0-preview
See the version list below for details.
dotnet add package AssertSyscall --version 0.1.0-preview
NuGet\Install-Package AssertSyscall -Version 0.1.0-preview
<PackageReference Include="AssertSyscall" Version="0.1.0-preview" />
<PackageVersion Include="AssertSyscall" Version="0.1.0-preview" />
<PackageReference Include="AssertSyscall" />
paket add AssertSyscall --version 0.1.0-preview
#r "nuget: AssertSyscall, 0.1.0-preview"
#:package AssertSyscall@0.1.0-preview
#addin nuget:?package=AssertSyscall&version=0.1.0-preview&prerelease
#tool nuget:?package=AssertSyscall&version=0.1.0-preview&prerelease
AssertSyscall
Verifies calls to the Linux API (syscalls) made by a test case.
Modern apps use a lot of external dependencies. At the same time, in most cases, an app CI/CD pipeline verifies the app code only. Thus we can be sure that the app code is safe, which cannot be said about used external code.
Using this library, you can declare the app/environment contract and be sure
that the app complies it. It makes your expectations transparent, eliminates
some zero-day vulnerabilities, and minimizes the possible attack surface.
And all of this is easy to inject to the existing CI/CD and tests.
All you need is to mark existing test cases with the AssertSyscall and define
your own rules - the contract between your app and the environment (OS).
Requirements
- Linux only.
- The
stracemust be pre-installed.
apt update && apt install -y strace
Usage example
The next example shows how to check that the tested code
writes to the /output directory only.
namespace AssertSyscall.NUnit.Tests;
[TestFixture]
[AssertSyscall] // <1>
class DenyFileWriteTest
{
[Test]
[DenyFileWrite(excludePaths: ["/output"])] // <2>
public void ShouldWriteToOutputDirOnly()
{
var dir = "/output";
var file = Path.Join(dir, "some.txt");
File.WriteAllText(file, "Some Content");
}
}
- The
AssertSyscallattribute marks that the test class verifies syscalls. - The
DenyFileWriteattribute defines a rule to verify syscalls made by the test case.
INFO
This example uses the
AssertSyscall.NUnitpackage.
Build
To build the package run:
./build.sh
The bin/publish/ directory will contain nuget-packages.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AssertSyscall:
| Package | Downloads |
|---|---|
|
AssertSyscall.NUnit
Verifies syscalls performed during a test execution. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.0-preview | 163 | 9/11/2025 |
| 0.1.0-preview | 141 | 9/9/2025 |