{"id":13788528,"url":"https://github.com/qbit/node-pledge","last_synced_at":"2025-04-12T06:31:16.070Z","repository":{"id":57142400,"uuid":"44639487","full_name":"qbit/node-pledge","owner":"qbit","description":"Bindings for for OpenBSD's pledge(2)","archived":false,"fork":false,"pushed_at":"2022-12-04T18:56:17.000Z","size":23,"stargazers_count":19,"open_issues_count":1,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-05-14T08:02:02.281Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qbit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-20T22:52:54.000Z","updated_at":"2024-01-12T18:06:11.000Z","dependencies_parsed_at":"2023-01-22T21:25:12.554Z","dependency_job_id":null,"html_url":"https://github.com/qbit/node-pledge","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qbit%2Fnode-pledge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qbit%2Fnode-pledge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qbit%2Fnode-pledge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qbit%2Fnode-pledge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qbit","download_url":"https://codeload.github.com/qbit/node-pledge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248252695,"owners_count":21072701,"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","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":[],"created_at":"2024-08-03T21:00:49.342Z","updated_at":"2025-04-12T06:31:11.034Z","avatar_url":"https://github.com/qbit.png","language":"C++","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"node-pledge\n===========\n\nBindings for for OpenBSD's [pledge(2)](http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man2/pledge.2?query=pledge)\n\n# What?\n\n`pledge(2)` allows a process to ratchet down the privileges it requires to run, if it attempts to access\na privilege it has pledged to not use, it will be killed by the kernel.\n\n# Example Usage\n\nInstall via npm:\n\n```\nnpm install --save node-pledge\n```\n\n```JavaScript\nvar http = require('http');\nvar pledge = require('node-pledge');\n\npledge.init(\"stdio rpath wpath prot_exec\");\n\nconsole.log(\"stuff\");\n\n// try to do something with http (will cause the kernel to kill node)\nhttp.get(\"http://www.google.com/\", function(res) {\n  console.log(res);\n}).on('error', function(e) {\n  console.log(e);\n});\n```\n\nOutput:\n\n```\nnode stuff.js\nstuff\nAbort trap (core dumped) \n```\n\nLine from `dmesg(8)`:\n\n```\nnode(24353): sysctl 6: 4 17 0 0 3 0\nnode(24353): syscall 202 \"\"\n```\n\n# This is an expirement!\n\nUse at your own risk! It will *ONLY* work on OpenBSD!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqbit%2Fnode-pledge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqbit%2Fnode-pledge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqbit%2Fnode-pledge/lists"}