{"id":19967388,"url":"https://github.com/teamstarter/graphql-query-count-limit","last_synced_at":"2026-07-01T19:32:23.109Z","repository":{"id":57253561,"uuid":"279249960","full_name":"teamstarter/graphql-query-count-limit","owner":"teamstarter","description":"Limit the number of query that can be performed in a single GraphQL request.","archived":false,"fork":false,"pushed_at":"2020-07-13T13:29:19.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-11T16:11:59.595Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/teamstarter.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-13T08:58:29.000Z","updated_at":"2020-07-13T13:29:22.000Z","dependencies_parsed_at":"2022-08-31T22:12:06.455Z","dependency_job_id":null,"html_url":"https://github.com/teamstarter/graphql-query-count-limit","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/teamstarter/graphql-query-count-limit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teamstarter%2Fgraphql-query-count-limit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teamstarter%2Fgraphql-query-count-limit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teamstarter%2Fgraphql-query-count-limit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teamstarter%2Fgraphql-query-count-limit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teamstarter","download_url":"https://codeload.github.com/teamstarter/graphql-query-count-limit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teamstarter%2Fgraphql-query-count-limit/sbom","scorecard":{"id":871667,"data":{"date":"2025-08-11","repo":{"name":"github.com/teamstarter/graphql-query-count-limit","commit":"003890659b92152706f1b996568092bd46829b96"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/2 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":"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":"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":"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":"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":"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":"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":"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":"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":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"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":"Vulnerabilities","score":0,"reason":"18 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7","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-24T04:25:59.808Z","repository_id":57253561,"created_at":"2025-08-24T04:25:59.808Z","updated_at":"2025-08-24T04:25:59.808Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35020870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-01T02:00:05.325Z","response_time":130,"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":[],"created_at":"2024-11-13T02:41:26.489Z","updated_at":"2026-07-01T19:32:23.089Z","avatar_url":"https://github.com/teamstarter.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"GraphQL Query Count Limit\n===================\n\nDead-simple defense against grouped GraphQL queries. Limit the number of the queries per request and the number of selections allowed at the root of each query.\n\n\n## Why?\n\nSuppose you have an `Album` type that has a list of `Song`s.\n\n```graphql\n{\n  album(id: 42) {\n    songs {\n      title\n      artists\n    }\n  }\n}\n```\n\nAnd perhaps you have a different entry point for a `Song` and the type allows you to go back up to the `Album`.\n\n```graphql\n{\n  song(id: 1337) {\n    title\n    album {\n      title\n    }\n  }\n}\n```\n\nThat opens your server to the possibility of a cyclical query!\n\n```graphql\nquery evil {\n  album(id: 42) {\n    songs {\n      album {\n        songs {\n            # Depth is covered by graphql-depth-limit...\n          }\n        }\n      }\n    }\n  }\n  album(id: 41) {\n    songs {\n      album {\n        songs {\n            # but one can add as many selection at the root of the query\n          }\n        }\n      }\n    }\n  }\n  # Creating a single-call-ddos\n  ...\n}\n# Also, most engines handles any number queries per request! Making another possible single-call-ddos possibility.\nquery evil2 {\n  album(id: 42) {\n    songs {\n      album {\n        songs {\n            ...\n          }\n        }\n      }\n    }\n  }\n  ...\n}\n```\n\n## Liming root selections and queries\n\ngraphql-query-count-limit will limit the number of queries per request and the number of root selections per query.\n\n## Usage\n\n```shell\n$ npm install graphql-query-count-limit\n```\n\nIt works with any library using graphql-server, such as, [apollo-server](https://www.apollographql.com/docs/apollo-server/), [express-graphql](https://github.com/graphql/express-graphql) and [koa-graphql](https://github.com/chentsulin/koa-graphql).\n\nHere is an example with Express.\n\n```js\nimport queryLimit from 'graphql-query-count-limit'\nimport express from 'express'\nimport graphqlHTTP from 'express-graphql'\nimport schema from './schema'\n\nconst app = express()\n\napp.use('/graphql', graphqlHTTP((req, res) =\u003e ({\n  schema,\n  validationRules: [ queryLimit(10) ]\n})))\n```\n\nThe first argument is the maximum number of queries in a single request. This will throw a validation error if more than the allowed amount if queries are specified.\u003cbr/\u003e\nThe second, optional, argument is the maximum amount of root selections on any query\u003cbr/\u003e\n\n```js\nqueryLimit(\n  3,\n  5\n)\n```\n\n## References\n\nThis library is made thanks to the awesome [graphql-depth-limit](https://github.com/stems/graphql-depth-limit) library that you should always install with graphql-query-count-limit as they are both needed for a better DDOS protection.\n\nAlso, once those two librairies are installed, you will still have to make sure that:\n\n* Limits/offset are enforced on all \"list\" endpoints\n* You have a rate limit system put in place","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteamstarter%2Fgraphql-query-count-limit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteamstarter%2Fgraphql-query-count-limit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteamstarter%2Fgraphql-query-count-limit/lists"}