Skip to content

Pagination loop has no upper bound #47

@andrew

Description

@andrew

fetch_all_pages loops as long as the server returns a next_page_token:

while page_token
  payload = original_payload.merge(page_token: page_token)
  response = post("/query", payload)
  vulns.concat(response["vulns"] || [])
  page_token = response["next_page_token"]
end

lib/brew/vulns/osv_client.rb:124-129

If OSV returns a buggy response that keeps echoing a token (or returns the same token twice), this allocates memory via vulns.concat until the process is killed.

A page counter that bails after some reasonable limit (50, 100) costs nothing and turns an infinite loop into a clear error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions