Skip to content

fix(findings): fix pagination, repository filter, severity, and type mapping#149

Merged
jonathanlam merged 1 commit into
mainfrom
fix/findings-bugs
May 19, 2026
Merged

fix(findings): fix pagination, repository filter, severity, and type mapping#149
jonathanlam merged 1 commit into
mainfrom
fix/findings-bugs

Conversation

@jonathanlam
Copy link
Copy Markdown
Member

Summary

  • Repository filter was silently ignored — the individual scanner endpoints (/sast/findings, /sca/*/findings, etc.) don't accept a repository query param. The CLI was sending it and getting unfiltered results back. Fix: switch to POST /admin/findings, the unified endpoint the dashboard uses, which accepts repository as a real filter field.

  • Limit was hard-capped at 100 server-side — every individual endpoint enforces a maximum of 100 results per page regardless of the limit value sent. The CLI also never followed the nextToken cursor returned in responses, so only the first ≤100 findings per scanner type were ever returned. Fix: the new endpoint paginates automatically (using page numbers) until hasMoreData is false or the requested limit is reached.

  • Severity filter only worked for SAST and CSPM — other endpoints silently ignored it. The unified endpoint handles severity across all types, but requires uppercase values (CRITICAL not critical). Fixed.

  • Type names were wrong for the unified endpoint — the API uses Code, Dependencies, Containers, Secrets, Pentest, BugHunting, Cloud rather than the CLI slugs. Added findingTypeToAPI mapping in both CLI and MCP.

  • MCP used singular type names (sca_dependency, sca_container) while the CLI used plural (sca_dependencies, sca_containers). Normalised to plural throughout.

  • nullify_search_findings MCP tool had the same bugs and received the same fixes: unified endpoint, pagination, severity casing, type mapping.

Test plan

Validated against NIB (api.nib.nullify.ai):

  • Baseline returns findings with correct total
  • --repo <name> returns only that repository's findings
  • --severity low returns only LOW severity findings (correct casing applied)
  • --type sast returns only Code type findings (mapping applied)
  • --type sca_dependencies returns only Dependencies type findings
  • --limit 250 fetches multiple pages and returns >100 findings when total exceeds 100
  • MCP nullify_search_findings produces identical results to CLI for all of the above
  • go test ./cmd/cli/cmd/... ./internal/mcp/... passes

…unified endpoint

Three additional issues discovered via live testing against the API:

1. Severity values must be uppercase (CRITICAL, HIGH, MEDIUM, LOW) — the
   unified endpoint rejects lowercase values silently, returning 0 results.

2. The unified endpoint uses PascalCase finding type names (Code,
   Dependencies, Containers, Secrets, Pentest, BugHunting, Cloud) rather
   than the CLI's internal slugs (sast, sca_dependencies, cspm, etc.).
   Added findingTypeToAPI mapping in both CLI and MCP.

3. Pagination uses page numbers, not scroll IDs — the API returns
   hasMoreData=true but scrollId=null. The loop now falls back to
   incrementing the page field when scrollId is absent, and correctly
   fetches all pages up to the requested limit.
@jonathanlam jonathanlam dismissed tim-thacker-nullify’s stale review May 19, 2026 04:26

The merge-base changed after approval.

@jonathanlam jonathanlam added the minor Minor version updates (features) label May 19, 2026
@jonathanlam jonathanlam merged commit f825946 into main May 19, 2026
2 of 3 checks passed
@jonathanlam jonathanlam deleted the fix/findings-bugs branch May 19, 2026 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Minor version updates (features)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants