Skip to content

security(api): bound public analytics response caches #370

Closed

Description

@dborup

Problem

On dborup/CoreScope master 1f423e0627976c961fb7a40f45016e817e582cc3, public analytics requests can create entries under client-selected filter/cache keys, and several maps in cmd/server/store.go still assign directly to keys such as rfCache[cacheKey], chanCache[cacheKey] and subpathCache[cacheKey]. TTL expiry does not itself cap the number of distinct keys retained before expiry. Invalid region/area inputs can also reach expensive analytics work before rejection.

Reference: nashmesh/CoreScope PR 18 (reference only). Related but different: #221 concerns regional node-query pool pressure, not these response-cache entry counts.

Requested change

  • Inventory all public analytics response caches whose keys incorporate user-controlled filters or time-window variants, including neighbor graph and relay airtime where applicable in this fork.
  • Give each affected map a fixed entry ceiling; remove expired entries first and use a deterministic, bounded eviction rule for remaining entries. Refreshing an existing key must not evict a different live entry.
  • Reject excessively long filter values and unknown configured areas before cache/index/graph work, without rejecting legitimate region or area selections.
  • Keep normal response schemas and valid-filter results unchanged.

Acceptance

  • Tests exercise each affected cache family with more distinct keys than the ceiling and prove bounded size and correct refresh/eviction behavior.
  • Handler tests prove invalid filters stop before expensive work, while valid filters keep working.
  • Focused race tests and the full server test suite pass; no unbounded per-request work is added to cache insertion.

The repository diff demonstrates the unbounded-map pattern; this issue does not claim a measured production memory incident.

Activity

  1. dborup commented on Oct 13, 2026

    @dborup
    OwnerAuthor

    Fixed by #430 (merged as dd712bc92ad916b489be3a9002cc0fefc328f43f). The region byte cap (128 bytes) and the unknown-area → 400 contract are listed under 'Left for the owner' in #430.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions