{"id":15592008,"url":"https://github.com/derhuerst/generate-node-policy-file","last_synced_at":"2025-04-15T05:02:13.859Z","repository":{"id":53732363,"uuid":"184406758","full_name":"derhuerst/generate-node-policy-file","owner":"derhuerst","description":"Generate a Node.js policy file for your code.","archived":false,"fork":false,"pushed_at":"2021-03-17T12:21:00.000Z","size":30,"stargazers_count":5,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T16:11:55.427Z","etag":null,"topics":["json","nodejs","security"],"latest_commit_sha":null,"homepage":"https://github.com/derhuerst/generate-node-policy-file#generate-node-policy-file","language":"JavaScript","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/derhuerst.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-01T11:29:36.000Z","updated_at":"2021-03-17T12:15:32.000Z","dependencies_parsed_at":"2022-09-26T20:01:48.078Z","dependency_job_id":null,"html_url":"https://github.com/derhuerst/generate-node-policy-file","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fgenerate-node-policy-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fgenerate-node-policy-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fgenerate-node-policy-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fgenerate-node-policy-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/derhuerst","download_url":"https://codeload.github.com/derhuerst/generate-node-policy-file/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248240932,"owners_count":21071040,"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":["json","nodejs","security"],"created_at":"2024-10-02T23:52:41.537Z","updated_at":"2025-04-15T05:02:13.840Z","avatar_url":"https://github.com/derhuerst.png","language":"JavaScript","funding_links":["https://github.com/sponsors/derhuerst"],"categories":[],"sub_categories":[],"readme":"# generate-node-policy-file\n\n**Generate a [Node.js policy file](https://nodejs.org/api/policy.html) for your code.**\n\n\u003e Policies are a security feature intended to allow guarantees about what code Node.js is able to load. The use of policies assumes safe practices for the policy files such as ensuring that policy files cannot be overwritten by the Node.js application by using file permissions.\n\n*Note:* In Node.js `12` and `13`, the [policy feature](https://nodejs.org/api/policy.html) is marked as **experimental**:\n\n\u003e This feature is still under active development and subject to non-backward compatible changes or removal in any future version. Use of the feature is not recommended in production environments. Experimental features are not subject to the Node.js Semantic Versioning model.\n\n[![npm version](https://img.shields.io/npm/v/generate-node-policy-file.svg)](https://www.npmjs.com/package/generate-node-policy-file)\n[![build status](https://api.travis-ci.org/derhuerst/generate-node-policy-file.svg?branch=master)](https://travis-ci.org/derhuerst/generate-node-policy-file)\n![ISC-licensed](https://img.shields.io/github/license/derhuerst/generate-node-policy-file.svg)\n[![support me via GitHub Sponsors](https://img.shields.io/badge/support%20me-donate-fa7664.svg)](https://github.com/sponsors/derhuerst)\n[![chat with me on Twitter](https://img.shields.io/badge/chat%20with%20me-on%20Twitter-1da1f2.svg)](https://twitter.com/derhuerst)\n\n\n## Installation\n\n```shell\nnpm install generate-node-policy-file\n```\n\n\n## Usage\n\nGenerate a list of required files by your app:\n\n```shell\nenv REQUIRED_FILES=required-files.json node -r generate-node-policy-file/track my-app.js\n```\n\nGenerate a [Node.js policy file](https://nodejs.org/api/policy.html) from the list:\n\n```shell\ngenerate-node-policy-file \u003crequired-files.json \u003epolicy.json\n```\n\nMake it read-only for the user the app will be running with:\n\n```shell\nsudo chown root:admin policy.json\nsudo chmod 755 policy.json\n```\n\nLet Node.js use it:\n\n```shell\nnode --experimental-policy=policy.json my-app.js\n```\n\n## Options\n\noption | description | default\n-------|-------------|--------\n`--base-dir`, `-d` | Directory the file paths are relative to. | `$CWD`\n`--on-error` | [Error behavior](https://nodejs.org/api/policy.html#policy_error_behavior). | `exit`\n`--pretty`, `-p` | Pretty-print the generated JSON. | –\n\n\n## Contributing\n\nIf you have a question or need support using `generate-node-policy-file`, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to [the issues page](https://github.com/derhuerst/generate-node-policy-file/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderhuerst%2Fgenerate-node-policy-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fderhuerst%2Fgenerate-node-policy-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderhuerst%2Fgenerate-node-policy-file/lists"}