Mid-level Track Roadmap

Turbo Streams: security

Turbo Streams: security examines what a signed stream name protects and what it leaves open. The lessons read the installed turbo-rails source. They show that one application-wide key signs every name, that the payload decodes with plain Base64, and that signed names never expire. Access control comes from the page guard that renders the turbo_stream_from tag. The course also covers scoping a stream to a record through GlobalID, custom channels with subscription_allowed?, and a four-question checklist for deciding what goes into a streamable.

What you'll learn

  • ✓Why a signed stream name is authentic without being authorized
  • ✓How Base64 decoding shows that signing does not hide a payload
  • ✓Using page guards such as require_login as the access boundary for a stream
  • ✓Scoping streams to records through GlobalID and to_gid_param
  • ✓Why signed names never expire and when a custom channel with subscription_allowed? is needed
  • ✓A checklist for choosing what goes into a streamable
Free preview · Lesson 1 3 min read

Signed does not mean authorized

A signed stream name (two courses ago) can't be tampered with. A client can't invent a new one; it can only present one the server generated. That fact answers one question and leaves another open. Proving a name is genuine says nothing about whether this visitor, right now, should be allowed to…

Read the full lesson free →

Curriculum

7 lessons
Type to start searching...