Skip to content

NAT-376: Prevent Config Properties From Leaking Across View Boundaries#115

Open
eugene-mux wants to merge 1 commit intomasterfrom
em/nat-376-fix-config-leak-across-view-boundaries
Open

NAT-376: Prevent Config Properties From Leaking Across View Boundaries#115
eugene-mux wants to merge 1 commit intomasterfrom
em/nat-376-fix-config-leak-across-view-boundaries

Conversation

@eugene-mux
Copy link
Contributor

@eugene-mux eugene-mux commented Mar 12, 2026

Summary

  • Snapshots config properties at view start so mid-view config changes cannot contaminate the current view's events
  • Fixes video_source_url (and other config fields) from Video A appearing on Video B's events when the app updates config before calling view="end"
  • Adds proper view lifecycle (view="end"/view="start") and video_source_url to the recycled player sample app

Root cause

_createEvent() appends m._configProperties last, intentionally letting customers override any property. But when the app updates config with new video metadata before calling view="end", the config update is processed on the task thread before viewend — so events still in the old view get the new video's metadata.

Fix

Snapshot _configProperties into _viewConfigSnapshot at view start. _createEvent() uses the snapshot instead of the live config. Config changes between views update the snapshot immediately; during an active view the snapshot is frozen. Playback mode changes (ad breaks) are the exception — they update the snapshot mid-view since that's intentional.

Test plan

  • Reproduced URL leak on device (Roku 3820X2): playing vid=Mux3 appeared in Mux1's view
  • Verified fix: zero mismatches across all events after fix
  • Automated stress test (20 rapid transitions): zero crashes, zero mismatches, all transitions 0-1ms
  • Manual monkey test (recycled player, 3 videos, rapid random switching): zero crashes, zero mismatches across 11,453 lines of output

🤖 Generated with Claude Code


Note

Medium Risk
Touches core analytics event construction and view lifecycle handling; mistakes could misattribute events or drop request/heartbeat telemetry during playback transitions.

Overview
Prevents config/video metadata leaking across view boundaries by snapshotting config at viewstart and using that frozen snapshot when building events, while still allowing intentional mid-view updates for player_playback_mode.

Hardens view-transition behavior by (1) ignoring heartbeats when not in a view, and (2) adding hostname-based filtering for stale segment download events using the previous view’s source hostname.

Updates sample apps to better exercise the lifecycle: the recycled player now explicitly sends view="end"/view="start" around content switches and sets video_source_url; the reset player adds a rapid-transition stress test menu item to repeatedly end/start views across alternating streams.

Written by Cursor Bugbot for commit f623cc5. This will update automatically on new commits. Configure here.

@eugene-mux eugene-mux changed the title fix: prevent config properties from leaking across view boundaries NAT-376: Prevent Config Properties From Leaking Across View Boundaries Mar 12, 2026
@eugene-mux eugene-mux force-pushed the em/nat-376-fix-config-leak-across-view-boundaries branch 2 times, most recently from 55d8e07 to 28981e9 Compare March 12, 2026 21:00
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@eugene-mux eugene-mux force-pushed the em/nat-376-fix-config-leak-across-view-boundaries branch 2 times, most recently from 348a91b to a2e3579 Compare March 12, 2026 22:14
Snapshot config properties at view start so mid-view config changes
cannot contaminate the current view's events. Fixes video_source_url
and other config fields from Video A appearing on Video B's events.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@eugene-mux eugene-mux force-pushed the em/nat-376-fix-config-leak-across-view-boundaries branch from a2e3579 to f623cc5 Compare March 12, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant