dotCMS / dotCMS/core

Audit follow-up: Analytics impression tracker leaks listeners and history monkey patches

Open
#36,017 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Parent epic: #36004

Finding

The analytics SDK impression tracker reportedly registers listeners and monkey-patches history.pushState / history.replaceState, but cleanup() does not undo all of them. The report says the sibling activity tracker has a better cleanup pattern.

Report references: libs/sdk/analytics/.../dot-analytics.impression-tracker.ts:217-283, libs/sdk/analytics/.../dot-analytics.impression-tracker.ts:479-506

Potential impact

Long-lived customer SPAs may accumulate listeners/patch layers over time, causing duplicate tracking, memory growth, or unexpected history behavior.

Suggested validation

Initialize and cleanup the impression tracker repeatedly in a SPA harness and inspect listener counts, patched history functions, and duplicate event behavior.

Possible fix

Mirror the activity tracker cleanup pattern: restore original history methods and unregister all listeners during cleanup().

Caveat

This was AI-found by Claude from .scratch/audit/REPORT.md. Please perform secondary validation of correctness, severity, and value before actioning.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with libs/sdk/analytics/.../dot-analytics.impression-tracker.ts lines 217-283 and 479-506, then compare the sibling activity tracker’s cleanup pattern. Repeatedly initialize and clean up the impression tracker in a SPA harness, checking listener counts, history methods, and duplicate events; done means cleanup restores the original history methods and unregisters all listeners.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.