Skip to content

Unbounded thread spawning when fetching vulnerability details #46

@andrew

Description

@andrew

For each formula with findings, one thread is spawned per vuln ID with no cap:

threads = batch_vulns.map do |v|
  Thread.new { client.get_vulnerability(v["id"]) }
end
full_vulns = threads.map(&:value)

lib/brew/vulns/cli.rb:121-124

A package with a couple of hundred known CVEs (openssl, curl, the kernel, etc.) opens that many simultaneous HTTPS connections to api.osv.dev. Each one creates a fresh Net::HTTP instance with its own TLS handshake.

Likely outcomes are file descriptor exhaustion locally or rate limiting from OSV, neither of which produces a clear error.

A simple bound would be slicing into groups of N and joining each group before starting the next. Or a thread pool if you'd rather pull in concurrent-ruby.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions