Skip to content

aggregator: /api/sw-probe accumulates unbounded in-memory script URLs #10539

Closed

Description

@dezren39

Problem

POST /api/sw-probe accepts client-reported service-worker script URLs and stores every unique foreign/evicted URL string forever in process memory, with no cap on entry count or key length. GET /api/sw-probe returns the full accumulated maps. The endpoint is unauthenticated.

Evidence

  • pm-stack/aggregator/src/push.ts:110-123 — recordSwProbe appends any string from report.registrations/report.evicted into module-level probe.foreignSeen / probe.evictedSeen maps without bounds:
    • if (typeof r === "string" && isForeignSwScript(r)) { probe.foreignSeen[r] = (probe.foreignSeen[r] ?? 0) + 1; }
    • evicted strings are stored similarly with no foreign-script filter.
  • pm-stack/aggregator/src/push.ts:126-133 — swProbeSummary() returns copies of both full maps, so response size grows with accumulated state.
  • pm-stack/aggregator/src/server.ts:3409-3415 — /api/sw-probe POST reads a JSON body and records it with no authentication gate in that route; GET exposes the running summary.

Request bodies are bounded by readJsonBody (100KB), but repeated requests can add many distinct entries over time, growing memory and the GET payload without limit.

Why it matters

Unbounded input-driven in-memory growth is a resource-exhaustion risk (memory/response bloat) for the long-lived aggregator process. Because the probe is observational, accumulation beyond what is useful provides no operational value.

Suggested fix shape

Bound the probe state: enforce a maximum number of tracked script URLs and/or maximum key length, drop/ignore entries beyond the cap (or keep only aggregate counts/top-N), and consider bounding the evicted map the same way. Optionally add lightweight input validation (e.g. only accept plausible URL/script-path strings) while keeping the endpoint fail-soft.

Activity

  1. added
    app/pm-stack
    on Nov 15, 2026
  2. developing-today commented on Nov 15, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: triaged / already_done
    task: 19320
    lane: any-w

    Triage verdict (fresh check 2026-11-17T06:36Z): issue #10539 is already resolved. PR #10633 (bound /api/sw-probe maps to cap unbounded memory growth) merged 2026-11-17T01:03:34Z, cross-referenced on this issue, and the issue was closed 2026-11-17T01:03:37Z carrying status:done.

    No follow-on packet needed. Completing queue task 19320 as already_done.

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

Metadata

Metadata

Assignees

Labels

app/pm-stackstatus:done

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions