Dev.to Security 🔐 Cybersecurity 👁 0 📖 3 min read

Paid live streams are an access-control problem, not a streaming problem

A merchant messaged me last week asking which app could stream a cooking class to Shopify, YouTube, Zoom and Instagram at the same time. The streaming half of that question is basically solved. StreamYard, OBS, Zoom Web

A merchant messaged me last week asking which app could stream a cooking class to Shopify, YouTube, Zoom and Instagram at the same time.

The streaming half of that question is basically solved. StreamYard, OBS, Zoom Webinar — pick one, it fans out. What nobody warns them about is the other half: once someone pays, who is allowed to watch, for how long, and what happens when the link gets forwarded.

That part is not a streaming problem. It's access control, and it's usually a single boolean (has_paid ) doing work it can't do.

Four places paid access leaks

  1. One link, many viewers. If the same meeting URL goes into the order confirmation email, the first buyer can forward it to five people. You sold one seat and got six attendees. You will never know.

  2. The link lives only in an email. People buy ten minutes before the class, then can't find the email. Your support inbox fills up with "where's my link" at exactly the wrong moment.

  3. Replay rights are never defined. The live seat is sold. The recording then gets sent to whoever asks, because nobody decided whether the recording was part of the purchase.

  4. Late buyers and refunds. Someone buys after the class started. Someone else refunds on day two. With a boolean, both cases are undefined.

Model an entitlement, not a flag

Each purchase should create a row with a window and a revocation timestamp:

create table entitlements (
id text primary key,
order_id text not null,
product_id text not null,
email text not null,
token text not null unique,
live_starts timestamptz not null,
live_ends timestamptz not null,
replay_until timestamptz,
revoked_at timestamptz
);

The token is the buyer's private key to the stream. It's cheap to generate and it gives you a per-buyer audit trail, which a shared meeting URL never will.

Checking it is a window comparison, not a lookup of a boolean:

func allowWatch(e Entitlement, now time.Time) bool {
if e.RevokedAt != nil {
return false
}
if now.Before(e.LiveStarts.Add(-15 * time.Minute)) {
return false // too early to join
}
if now.Before(e.LiveEnds) {
return true // live window, plus 15 min grace to join
}
return e.ReplayUntil != nil && now.Before(*e.ReplayUntil)
}

Two details that matter more than they look:

  • A grace window before start. Without it, people who arrive early get a 403 and email you.
  • Replay as a separate expiry.replay_until lets you bundle the recording, sell it separately, or give it a 7-day window — without changing the live logic. ## Rotate the ingest key after each session If buyers ever get near the ingest side (self-hosted streaming, a custom player), rotate the stream key per session. A forwarded ingest key is worse than a forwarded watch link, because it doesn't just let someone watch — it lets them broadcast into your room.

Rotating per session means a leaked key is dead by the next class, and you never have to chase it.

What I'd skip

Don't reach for DRM or per-viewer watermarking on a cooking class. The realistic threat model is "one buyer shares the link with a friend", not a piracy ring. A per-buyer token plus a defined replay window solves the actual problem for a fraction of the work.

If you've sold access to a live stream: what did you end up enforcing — the link, the session, or the person? I'm curious whether anyone has found a lighter-weight pattern than per-buyer tokens.

I build a live selling widget for Shopify/WooCommerce stores, which is where most of these edge cases showed up: https://durianlive.com

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.