infisical icon indicating copy to clipboard operation
infisical copied to clipboard

Can't list more than 200 certificates

Open bkcsoft opened this issue 2 months ago • 1 comments

Describe the bug

Listing certificates in either the UI or API is limited to at most 200 entries (limit=100, offset=100). We have on the order of thousands.

The error is on this line https://github.com/Infisical/infisical/blob/b54e3d1e4244b0cc05cba1e4bf5b663ad16fa553/backend/src/server/routes/v2/deprecated-project-router.ts#L373 It either needs to be set way higher, or the limit removed entirely. In short: a list function should not have a limit lower than the amount you can put in that collection.

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'Certifiates'
  2. Generate more than 200 certificates
  3. List certificates by 100 per page
  4. Page 1 will load (limit=100, offset=0)`
  5. Page 2 will load (limit=100, offset=100)´
  6. Page 3 will fail to load, since offset > 100

This will work for <100 per page as well, but you still can't list more than 200 certificates

Expected behavior

I expect to be able to list all certificates

Screenshots

{"level":30,"time":1760000977443,"pid":1729348,"hostname":"infisical-01","reqId":"req-XRZmpyA7ZPgtoj","severity":"INFO","req":{"method":"GET","url":"/api/v2/workspace/<REDACTED>/certificates?offset=200&limit=100","hostname":"10.142.206.179:8080","remoteAddress":"10.142.206.179","remotePort":40376},"msg":"incoming request"}
{"level":30,"time":1760000977452,"pid":1729348,"hostname":"infisical-01","reqId":"req-XRZmpyA7ZPgtoj","orgId":"<REDACTED>","severity":"INFO","msg":"injectPermission: Injecting permissions for [permissionsForIdentity=<REDACTED>] [type=user]"}
{"level":30,"time":1760000977452,"pid":1729348,"hostname":"infisical-01","reqId":"req-XRZmpyA7ZPgtoj","orgId":"<REDACTED>","severity":"INFO","msg":"getPlan: attempting to fetch plan for [orgId=<REDACTED>] [projectId=undefined]"}
{"level":30,"time":1760000977452,"pid":1729348,"hostname":"infisical-01","reqId":"req-XRZmpyA7ZPgtoj","orgId":"<REDACTED>","severity":"INFO","msg":"getPlan: Process done for [orgId=<REDACTED>] [projectId=undefined]"}
{"level":50,"time":1760000977455,"pid":1729348,"hostname":"infisical-01","reqId":"req-XRZmpyA7ZPgtoj","severity":"ERROR","err":{"type":"ZodError","message":"[\n  {\n    \"code\": \"too_big\",\n    \"maximum\": 100,\n    \"type\": \"number\",\n    \"inclusive\": true,\n    \"exact\": false,\n    \"message\": \"Number must be less than or equal to 100\",\n    \"path\": [\n      \"offset\"\n    ]\n  }\n]","stack":"ZodError: [\n  {\n    \"code\": \"too_big\",\n    \"maximum\": 100,\n    \"type\": \"number\",\n    \"inclusive\": true,\n    \"exact\": false,\n    \"message\": \"Number must be less than or equal to 100\",\n    \"path\": [\n      \"offset\"\n    ]\n  }\n]\n    at get error [as error] (file:///opt/infisical-core/server/node_modules/zod/lib/index.mjs:587:31)\n    at ZodObject.parse (file:///opt/infisical-core/server/node_modules/zod/lib/index.mjs:663:22)\n    at <anonymous> (/opt/infisical-core/server/src/server/plugins/fastify-zod.ts:134:30)\n    at validateParam (/opt/infisical-core/server/node_modules/fastify/lib/validation.js:110:36)\n    at validate (/opt/infisical-core/server/node_modules/fastify/lib/validation.js:154:19)\n    at preValidationCallback (/opt/infisical-core/server/node_modules/fastify/lib/handleRequest.js:92:25)\n    at IncomingMessage.next (/opt/infisical-core/server/node_modules/fastify/lib/hooks.js:233:9)\n    at AsyncResource.runInAsyncScope (node:async_hooks:206:9)\n    at Object.<anonymous> (/opt/infisical-core/server/node_modules/@fastify/request-context/index.js:53:21)\n    at hookIterator (/opt/infisical-core/server/node_modules/fastify/lib/hooks.js:405:10)","aggregateErrors":[{"type":"Object","message":"Number must be less than or equal to 100","stack":"","code":"too_big","maximum":100,"inclusive":true,"exact":false,"path":["offset"]}],"issues":[{"code":"too_big","maximum":100,"type":"number","inclusive":true,"exact":false,"message":"Number must be less than or equal to 100","path":["offset"]}],"name":"ZodError","statusCode":400,"code":"FST_ERR_VALIDATION","validationContext":"querystring"},"msg":"[\n  {\n    \"code\": \"too_big\",\n    \"maximum\": 100,\n    \"type\": \"number\",\n    \"inclusive\": true,\n    \"exact\": false,\n    \"message\": \"Number must be less than or equal to 100\",\n    \"path\": [\n      \"offset\"\n    ]\n  }\n]"}
{"level":30,"time":1760000977457,"pid":1729348,"hostname":"infisical-01","reqId":"req-XRZmpyA7ZPgtoj","severity":"INFO","res":{"statusCode":422},"responseTime":13.229728698730469,"msg":"request completed"}

(orgId, workspaceSlug, and projectId redacted out of habbit)

Platform you are having the issue on:

Self-hosted. Production runs on v0.146.0 but the error is still in latest

bkcsoft avatar Oct 09 '25 09:10 bkcsoft

Would like to work on this

Guru6163 avatar Oct 10 '25 09:10 Guru6163