{"id":31721168,"url":"https://github.com/axelboberg/node-policy-agent","last_synced_at":"2025-10-09T03:42:08.341Z","repository":{"id":97615548,"uuid":"186897664","full_name":"axelboberg/node-policy-agent","owner":"axelboberg","description":"An authorization policy framework for NodeJS, inspired by OPA","archived":false,"fork":false,"pushed_at":"2020-05-16T11:42:28.000Z","size":182,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-12T21:21:21.551Z","etag":null,"topics":["auth","authz","opa","policy","security"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/axelboberg.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-15T20:24:13.000Z","updated_at":"2021-05-27T15:35:54.000Z","dependencies_parsed_at":"2023-03-09T03:00:24.155Z","dependency_job_id":null,"html_url":"https://github.com/axelboberg/node-policy-agent","commit_stats":{"total_commits":29,"total_committers":3,"mean_commits":9.666666666666666,"dds":0.3448275862068966,"last_synced_commit":"1a828b0af4c26923d1d2febf42b9fea540197938"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/axelboberg/node-policy-agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axelboberg%2Fnode-policy-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axelboberg%2Fnode-policy-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axelboberg%2Fnode-policy-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axelboberg%2Fnode-policy-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/axelboberg","download_url":"https://codeload.github.com/axelboberg/node-policy-agent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axelboberg%2Fnode-policy-agent/sbom","scorecard":{"id":219877,"data":{"date":"2025-08-11","repo":{"name":"github.com/axelboberg/node-policy-agent","commit":"1a828b0af4c26923d1d2febf42b9fea540197938"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/axelboberg/node-policy-agent/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/axelboberg/node-policy-agent/test.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"30 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T02:15:46.207Z","repository_id":97615548,"created_at":"2025-08-17T02:15:46.207Z","updated_at":"2025-08-17T02:15:46.207Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000714,"owners_count":26082911,"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-10-09T02:00:07.460Z","response_time":59,"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":["auth","authz","opa","policy","security"],"created_at":"2025-10-09T03:42:06.328Z","updated_at":"2025-10-09T03:42:08.335Z","avatar_url":"https://github.com/axelboberg.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Test](https://github.com/axelboberg/node-policy-agent/workflows/Test/badge.svg)\n\n# node-policy-agent\n\nA framework for creating authorization policies. Loosely inspired by [OPA](https://www.openpolicyagent.org).\n\n## Example usage\n\n```javascript\n  const { Agent, should } = require('node-policy-agent')\n\n  const policy = [\n    // /api/users/:id\n    [\n      should.matchUri('$input.path', '/api/users/:id'),\n      should.equal('$input.method', 'GET'),\n      should.contain('$input.user.roles', 'admin')\n    ],\n\n    // /api/foo\n    [\n      should.matchUri('$input.path', '/api/foo'),\n      should.equal('POST', 'POST'),\n\n      // A custom rule\n      input =\u003e { \n        if (input.myParam === 'myValue' \u0026\u0026 1 + 1 === 2) return true\n        return false\n      }\n    ]\n  ]\n\n  const myAgent = new Agent(policy)\n\n  const granted = myAgent.authorize({\n    path: '/api/foo/username',\n    method: 'GET',\n    user: {\n      roles: [\n        'admin',\n        'support'\n      ]\n    }\n  })\n\n  // granted === true\n```\n\n## API  \n\n### `new Agent(policies [,opts])`  \nCreate a new Agent\n\n### `.authorize(input [,policies [,opts]])`  \nAuthorize some input, provided policies will be used in place of the ones used when creating the Agent.\n\n### Options  \nOptions for both the constructor and `.authorize()`.\n\n```\n{\n  detailedResponse: false // Return more details when authorizing. Will return a Boolean if false. False is default.\n}\n```\n\n### Custom rules  \nPolicies are defined by a set of rules. Each rule is a function that processes the input value and returns a boolean whether or not the rule passed. The optional `output` argument is an object to use for any output data that should be sent back to `.authorize()` if the option `detailedResponse` is set to `true`, if set to `false`, `output` will not be accessible.\n\n```javascript\n  const myPolicy = [\n    [\n      /**\n       * Rule without output\n       */\n      input =\u003e {\n        return input.username === 'Alice'\n      },\n\n      /**\n       * Rule with output\n       */\n      (input, output) =\u003e {\n        output.userIsAlice = input.username === 'Alice'\n        return input.username === 'Alice'\n      }\n    ]\n  ]\n```\n\n### Built in rules  \nThe exported `require('node-policy-agent').should` contains the following pre-built rules:\n\n#### `.equal(val1, val2)`  \nCheck if two values are equal\n\n#### `.matchObject(obj1, obj2)`  \nCheck if two objects contain the same keys and values\n\n#### `.matchRegex(str, regexp)`  \nCheck if a string matches a regular expression\n\n#### `.matchUri(str, pattern)`  \nCheck if a string matches a uri-pattern,\nvalid patterns can contain placeholders idicated by a colon, such as `/api/users/:id`. Trailing slashes are automatically removed from both arguments.\n\n#### `.beLessThan(num1, num2)`  \nCheck if `num1` is less than `num2`\n\n#### `.beMoreThan(num1, num2)`  \nCheck if `num1` is more than `num2`\n\n#### `.contain(set, val)`  \nCheck if the set contains the value, the set can be either a string or an array\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxelboberg%2Fnode-policy-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxelboberg%2Fnode-policy-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxelboberg%2Fnode-policy-agent/lists"}