Skip to content

Treat SRT Stream IDs as write-only secrets - #46

Draft
pjeweb wants to merge 6 commits into
osb/base/stream-id-secretfrom
osb/pr/stream-id-secret
Draft

pjeweb wants to merge 6 commits into
osb/base/stream-id-secretfrom
osb/pr/stream-id-secret

Conversation

@pjeweb

@pjeweb pjeweb commented Nov 12, 2026 •

Copy link
Copy Markdown

Why

An SRT Stream ID is often the publish key for a channel: whoever has it can stream to that channel. Today the box sends the saved Stream ID and relay override back out every time the configuration is read, pushed or applied, so anyone who can open the web app, or read a log, can copy it.

What

  • The web app only learns whether a Stream ID is set, never the saved value. Remote viewers don't even learn that: remote status and remote command results drop the IDs and the "is set" flags.
  • The Stream ID field starts empty and masked. Show reveals only what you type now. Leaving it untouched keeps the saved ID, typing replaces it, and an explicit Clear removes it on Save. All ten languages.
  • Saved IDs keep working with no migration. Config files are written owner-only, and logs, debug traces, error details and downloaded journals scrub Stream IDs.
  • The ID still travels in clear over the network, even with SRT encryption on. This protects local access, the UI and logs only.

How: both fields become write-only in the API. Leaving a field out keeps the saved value, a non-empty string replaces it and an empty string clears it; reads report srt_streamid_configured and relay_streamid_override_configured instead. Older clients have to be upgraded together with the backend, because they would clear the ID by saving the now-empty field. docs/STREAM-ID-SECURITY.md explains the behaviour in English and Spanish.

I also changed the tests so they check what leaves the box rather than how this branch builds it. The integration branch has since replaced the config writer, the journal download and the remote config format, and the old tests failed there even though no Stream ID leaked. Now the permission test saves through the normal config save, and the journal tests check that no Stream ID reaches the download, the log or the error notice.

Your call: I left the "is set" flags out of remote results on purpose, because nothing remote reads them and the remote status allowlist (#63) doesn't carry destination settings. If a remote setup screen ever needs to show "Stream ID saved", it's a one-line addition next to the existing relay_server_configured there.

This targets osb/base/stream-id-secret, a review base that mirrors tested upstream main, so the diff only shows the security change. #45 builds on this PR.

Screenshots

Mock data; the same state at the PR base and head.

Before After
Before: Write-only Stream ID controls (390 px) After: Write-only Stream ID controls (390 px)
Before: Write-only Stream ID controls (1280 px) After: Write-only Stream ID controls (1280 px)

How to verify

Save a Stream ID, reload Settings: the field is empty and the stream still starts with the saved ID. Type a new one to replace it, or use Clear and Save to remove it. Download the journal or look at the logs: the ID doesn't appear. apps/backend/src/helpers/stream-id-secret.test.ts covers the scrubbing.

Testing and limits
  • The focused backend tests, rpc, translations and focused frontend tests pass, as do lint and type checks. Earlier full backend, frontend and browser runs on this topic passed apart from unrelated test-environment failures that passed on rerun.
  • After the test update: full backend suite on this branch, 12247 pass, 0 fail, plus the backend type check. Merged onto the integration branch, both as it is today and with the next train's PRs (including Bound remote status with an explicit payload allowlist #63) on top, the dry run's gates pass: frontend build and size budget, type check, 739 focused backend tests, 166 frontend, 849 rpc, 857 translation tests.
  • Known gap, not new here: a Stream ID that is no longer saved and sits inside doubly escaped JSON (\"srt_streamid\":\"…\") isn't blanked. Plain journals never contain that form; the saved ID is always scrubbed.
  • Scrubbing matches whole tokens in many encodings (form, URL, double URL, JSON escapes, inspection quoting), so short IDs don't break ordinary words.
  • Typed arrays, secret object keys and a few unusual encodings aren't scrubbed. Very short numeric IDs keep the existing behaviour.

Risks

An older web app talking to this backend would clear the saved ID on its next save, so both have to be updated together.


Checklist

  • Docs updated if behavior or structure changed (Rule A: AGENTS.md within budget, README, docs/, versions.yaml)
  • User docs (Rule G): no user-visible change, OR ceralive-docs PR updates English and Spanish, plus ceralive-website PR if a landing claim changed
  • Started from updated main; branch rebased on latest canonical branch (Rule B)
  • Rule D local-scratch reference check passes for tracked files
  • Tests pass; QA evidence attached or linked

@pjeweb pjeweb mentioned this pull request Nov 14, 2026
2 of 5 tasks
The writer, journal and remote-config tests pinned how this branch builds
its output, not what may leave the box, so they broke once the integration
branch replaced the writer, the journal download and the remote config DTO.

- The permissions test now saves through saveConfig, so it holds whether
  the atomic writer or its caller applies the 0600 mode.
- The journal tests check that no Stream ID reaches the returned download,
  the download event, the log or the error notice, instead of the call
  count and the exact message text.
- Remote config now withholds the *_configured flags too. A remote viewer
  needs stream health, not whether a publish key is saved; the local app
  keeps the flags for its Stream ID field.
pjeweb added a commit that referenced this pull request Nov 16, 2026
@pjeweb pjeweb added the upstream: waits for intent Needs an issue or maintainer agreement before an upstream proposal. label Nov 16, 2026
pjeweb added a commit that referenced this pull request Nov 17, 2026
pjeweb added a commit that referenced this pull request Nov 17, 2026
pjeweb added a commit that referenced this pull request Nov 18, 2026
pjeweb added a commit that referenced this pull request Nov 18, 2026
pjeweb added a commit that referenced this pull request Nov 19, 2026
@pjeweb pjeweb added the train: image-5 In the integration that ships in image 5; the label moves on when images advance. label Nov 21, 2026
pjeweb added a commit that referenced this pull request Nov 21, 2026
pjeweb added a commit that referenced this pull request Nov 22, 2026
pjeweb added a commit that referenced this pull request Nov 23, 2026
pjeweb added a commit that referenced this pull request Nov 24, 2026
pjeweb added a commit that referenced this pull request Nov 24, 2026
@pjeweb pjeweb added train: image-6 In the integration that ships in image 6; the label moves on when images advance. and removed train: image-5 In the integration that ships in image 5; the label moves on when images advance. labels Nov 24, 2026
pjeweb added a commit that referenced this pull request Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

train: image-6 In the integration that ships in image 6; the label moves on when images advance. upstream: waits for intent Needs an issue or maintainer agreement before an upstream proposal.

Development

Successfully merging this pull request may close these issues.

1 participant