{"id":33210522,"url":"https://github.com/NattyNarwhal/pledge.cs","last_synced_at":"2025-11-21T05:02:24.466Z","repository":{"id":151684753,"uuid":"55780707","full_name":"NattyNarwhal/pledge.cs","owner":"NattyNarwhal","description":"OpenBSD's pledge(2) for .NET","archived":false,"fork":false,"pushed_at":"2016-04-12T22:29:55.000Z","size":18,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T07:05:05.680Z","etag":null,"topics":["openbsd-pledge","pledge"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NattyNarwhal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-04-08T13:24:19.000Z","updated_at":"2018-03-19T17:21:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"214b71a2-6d24-4afe-85a1-d0ab2518f57b","html_url":"https://github.com/NattyNarwhal/pledge.cs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NattyNarwhal/pledge.cs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NattyNarwhal%2Fpledge.cs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NattyNarwhal%2Fpledge.cs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NattyNarwhal%2Fpledge.cs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NattyNarwhal%2Fpledge.cs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NattyNarwhal","download_url":"https://codeload.github.com/NattyNarwhal/pledge.cs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NattyNarwhal%2Fpledge.cs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285560043,"owners_count":27192467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-21T02:00:06.175Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["openbsd-pledge","pledge"],"created_at":"2025-11-16T11:00:28.373Z","updated_at":"2025-11-21T05:02:24.461Z","avatar_url":"https://github.com/NattyNarwhal.png","language":"C#","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"This is a library that allows C# and other .NET languages to use OpenBSD's\npledge(2) syscall to restrict their permissions. If used on other platforms,\nthe library will simply throw a PlatformNotSupportedException, which can be\ncaught and safely ignored. On the event the pledge call fails, the library\nwill throw Win32Exceptions, which again can be caught by your application,\nand you can fail as needed.\n\nMono seems to require the promises \"vminfo cpath\" at a minimum, otherwise,\nit'll crash on exit. From a quick investigation, it seems cpath is needed\nby `shm_unlink` and vminfo by the sysctl `kern.boottime`.\n\n# Building info\n\nThe only dependencies are Mono (4.2.1 from packages on OpenBSD 5.9 works\nfine - it'll very likely work on older versions of Mono, possibly by\nchanging the compiler.) and `Mono.Posix`.\n\nJust type `make`. The library and documentation will be created, ready to\ninstall into the GAC or for distribution. XML documentation is created as\nwell.\n\n# Using\n\nAfter it's built, you can simply link in `pledge.dll`. `pledgetest.cs`\ncontains usage examples and handling the exceptions it throws in the event\nyour code isn't running on a new enough version of OpenBSD or it pledge\nitself encounters an error.\n\n# Licensing\n\nThe license is the same as OpenBSD's. See the comments in the source.\n\n# Testing \n\nTyping `make test` will create a small executable to test pledge, and\nexecute it to see if it's working. You can then use `mono pledgetest.exe`\nand pass it promises to execute with those promises. You should be able to\nsee its messages as it outputs to stdout unpledged, pledges, and then\noutputs to stdio again, with pledge. In the event the executable does\nsomething forbidden (like outputting to stdio) you'll see it fail.\n\n    # Pledging with the minimum parameters for pledgetest\n    $ mono pledgetest.exe stdio vminfo cpath\n    Pledging...\n    Pledged!\n    # When we omit stdio, the kernel will kill it when it tries to use it\n    $ mono pledgetest.exe vminfo cpath\n    Pledging...\n    Abort trap (core dumped)\n\n# TODO\n\n* It would be nice if we could have some kind of type safety for promises,\n  and guarantee the minimum for the runtime.\n* Managed code sanity-checking before we make the syscall.\n* Support other OpenBSD specific APIs. (like sendsyslog)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNattyNarwhal%2Fpledge.cs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNattyNarwhal%2Fpledge.cs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNattyNarwhal%2Fpledge.cs/lists"}