Skip to content

[all-mcp] getContacts has unbounded getX-per-id fan-out (no limit) — sister to #25 #34

@kiki830621

Description

@kiki830621

Problem

Surfaced by PR #32 verify (security reviewer Q2). getContacts has the same
getX-per-id fan-out shape that #25 just bounded for limit — but with no
limit at all
. The handler calls getContacts and then issues one getChat
(or equivalent) round-trip per returned contact id, with nothing capping the
number of ids processed.

This is strictly worse than the path #25 fixed: #25's getChats/searchChats
now reject limit > 10_000 via validateLimitCap, but getContacts iterates
the full contact list unconditionally. A large address book translates directly
into N sequential TDLib round-trips.

Type

bug (resource / fan-out amplification)

Expected

Apply the same bounding discipline as #25:

  • Cap the number of per-id round-trips (reuse validateLimitCap / a parseLimit-style bound, or page the contact list)
  • Decide the right default ceiling (parity with the 10_000 used elsewhere, or a contact-specific bound)
  • Test: oversized contact set does not fan out unbounded

Code Reference

Source

PR #32 6-AI verify, security reviewer Q2: #32 (comment)

Related: #25 (bounded the limit fan-out paths), #22/#23 (same parser-consistency cluster)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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