Repository navigation
feat(service)!: Require the token for every run - #70
Merged
Merged
Conversation
Each run now needs the token, in every mode. Before, anyone could start a replay run, so CI of forks could replay without a secret. That made every recording readable by anyone who could guess a tenant name. With no runs from untrusted clients, the locked-down path for them goes away: the key worker, the shared body budget, the per-client and global run caps, the idle and short run timeouts, the replay-only refusal, and the smaller learn and value limits. All runs now explain their misses. The clients default to auto mode and fail early without ROACH_TOKEN or the action token input, unless ROACH_MODE is off. Jobs that must not record set ROACH_MODE=replay. The service config keeps writeTokenHash, so the deploy needs no change. Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
sentry-junior
Bot
force-pushed
the
feat/require-token-for-runs
branch
from
November 14, 2026 18:04
da68b2d to
dd335d2
Compare
A client without the token no longer fails. The vitest global setup and the action run the tests or the command without Roach, so requests go direct, and they say so. Local runs and CI of forks then work with no setup. A ROACH_MODE other than off asks for a run, so it still needs the token and fails without it. Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com> Co-Authored-By: David Cramer <david@sentry.io>
With one kind of run, each of these had one value. The learn limit moves into secrets.ts as a constant, keyRequest always uses keyTimeLimit(), and extractValues no longer counts values toward a maximum that nothing set. Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
dcramer
approved these changes
Nov 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every run now needs the service token, in every mode. Before, anyone could start a
replayrun, so CI of forks could replay without a secret. That made each recording readable by anyone who knew the tenant name.This uses one token for reads and writes: the existing
ROACH_TOKEN/writeTokenHash. There is no separate read token.What changes
POST /__roach/runschecks the token first and returns 401 without it, or with a wrong one, before it reads the body. This applies in every mode.key-worker.ts)replayOnlyrefusalWorkLimit,LearnLimit, themaxValuescount inextractValues, the time-limit argument ofkeyRequest)changeon its misses in stats and reports. That was only for runs with the token before.ROACH_MODEother thanoff(for examplereplay) fails without the token, so a job that must not go live can't silently go live.startRemoteRunnow requirestoken.RefusalReasonlosesreplayOnly. Theroach.writespan attribute and thebusy/timeoutresults are gone.action.yml, and the deploy/gcp comments are updated. Terraform needs no change, because the config keepswriteTokenHash.Breaking
The consumer repos already have
ROACH_TOKENin CI, so their jobs behave the same. Jobs without the token, such as CI of forks, now send requests direct (or fail, if they set aROACH_MODEother thanoff) instead of replaying.Follow-up (not in this PR)
The PROXY-header handling (
proxyProtocol,clients.ts) now only strips the header, since nothing uses the client address. Removing it means changingproxy_headeron the load balancer at the same time as a service deploy, so it is left for a separate change. RenamingwriteTokenHashhas the same deploy-ordering problem, so it keeps its name.via @dcramer.
--
View Session [Sentry]