{"id":18935900,"url":"https://github.com/air-cc/koa-acl-swagger","last_synced_at":"2026-03-09T22:31:30.202Z","repository":{"id":143882671,"uuid":"73365930","full_name":"air-cc/koa-acl-swagger","owner":"air-cc","description":"a role base access controller and working with swagger (OpenAPI)","archived":false,"fork":false,"pushed_at":"2017-06-23T09:11:03.000Z","size":22,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-03T14:48:59.433Z","etag":null,"topics":["acl","koa","rest-api"],"latest_commit_sha":null,"homepage":"","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/air-cc.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-11-10T09:19:50.000Z","updated_at":"2018-09-15T11:41:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"9a9b510a-e305-46ed-9c4b-bd381a78c2e8","html_url":"https://github.com/air-cc/koa-acl-swagger","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/air-cc/koa-acl-swagger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/air-cc%2Fkoa-acl-swagger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/air-cc%2Fkoa-acl-swagger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/air-cc%2Fkoa-acl-swagger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/air-cc%2Fkoa-acl-swagger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/air-cc","download_url":"https://codeload.github.com/air-cc/koa-acl-swagger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/air-cc%2Fkoa-acl-swagger/sbom","scorecard":{"id":173322,"data":{"date":"2025-08-11","repo":{"name":"github.com/air-cc/koa-acl-swagger","commit":"00aa5f100dfa091bb3260e06afa28a98d541fffe"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"Code-Review","score":0,"reason":"Found 0/10 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":"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":"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE: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"}}]},"last_synced_at":"2025-08-16T17:07:26.232Z","repository_id":143882671,"created_at":"2025-08-16T17:07:26.232Z","updated_at":"2025-08-16T17:07:26.232Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30314627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T20:05:46.299Z","status":"ssl_error","status_checked_at":"2026-03-09T19:57:04.425Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["acl","koa","rest-api"],"created_at":"2024-11-08T12:04:54.657Z","updated_at":"2026-03-09T22:31:30.181Z","avatar_url":"https://github.com/air-cc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Koa-ACL-Swagger\n\n**NOTICE: can not be used in production**\n\na role base access controller and working with swagger (named OpenAPI now)\n\nIn YAML file, add `x-resource` option to each path. when a user visit this url, the middleware will check the permission based on resource name and HTTP method. like \"user `test-user` have the permission `post` of the resource `pets`\". so you should set role-base permission before.\n\nsee demo in `examples/app`\n\n\n## Install\n\u003e Node.js \u003e= 6.x \u0026\u0026 Koa \u003e= 2.x\n\n`npm install koa-acl-swagger`\n\n## Usage\n\n```javascript\nimport Koa from 'koa'\nimport Acl from 'koa-acl-swagger'\n\nconst app = new Koa()\n\nconst acl = new Acl({\n  store: {\n    type: 'redis',\n    client: aclStore,\n    prefix: 'examples:app:'\n  },\n  getUserId: async (ctx)=\u003e {\n    return 'test'\n  },\n  api: {\n    dir: path.join(__dirname, './api.yaml'),\n    skip: 1\n  }\n})\n\n// init permissions by acl\n// ....\n\napp.use(acl.getMiddleware())\n\napp.listen(3000)\n```\n\n## Class\n\n### AclSwagger\n\n**params**\n\n``` javascript\nstore\n  {\n    type    {string}          database type. redis | mongodb | memory can be used, default: memory\n    client  {object}          database client\n    prefix  {string}          saved prefix\n  }\ngetUserId   {async-function}  return user id for check permission\n                              , the arguments include current koa context object\napi\n  {\n    dir     {string}          api.yaml file direction\n    skip    {number}          number of components in the url to be ignored for checking\n    filter  {function}        return false when you don't want this url be checked\n                              , the arguments include current `url` and `method`\n  }\nerror       {json-object}     replace the default error message\n                              , default:\n                              {\n                                \"NO_PERMISSION\": \"no permission\",\n                                \"NO_AUTH\": \"no auth\",\n                                \"UNKNOWN\": 'unknown error'\n                              }\n```\n\n## Methods\n\n\n### getMiddleware()\n\n  return a middleware for koa@2.x\n\n### [Acl module](https://github.com/OptimalBits/node_acl) Async function\n\n  convert [acl module](https://github.com/OptimalBits/node_acl) functions to async style (translate by [bulebird](https://github.com/petkaantonov/bluebird)). like `addUserRolesAsync` `allowAsync` `isAllowedAsync` ...\n\n### allRolesAsync()\n\n  return all roles (async style)\n\n### removeUserAllRolesAsync(userId)\n\n  remove all roles from a given user (async style), and return true if removed\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fair-cc%2Fkoa-acl-swagger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fair-cc%2Fkoa-acl-swagger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fair-cc%2Fkoa-acl-swagger/lists"}