Turn on Railway PR environments and every pull request gets a copy of your base environment, and the base is production unless you changed it. The copy is generous with one kind of secret and strict with the other. That split is what the diagram shows.

Reading the diagram
Start at the top. Both green boxes live in your production environment. Green means server-side: before a PR environment exists, nothing outside Railway can read either one.
Left, the red edge: unsealed variables. Railway's PR environment guide says the environment "replicates your entire base environment, including services, networking, and variables." So DATABASE_URL and any sk_live_ key arrive in the preview with the same values production uses. It's the only emphasised edge because it's the one that puts live credentials somewhere new.
Right, dotted: sealed variables. Railway's variables docs put it in one line: "Sealed variables are not copied over when creating PR environments." Nothing crosses this edge, which is why it's dotted.
Middle: the PR environment. It's red because it's reachable. If the production service has a Railway domain, the preview gets one too, and Railway's bot posts it on the pull request, where everyone with read access to the repo can see it.
Bottom, amber: the crash. Your code still asks for STRIPE_SECRET_KEY. In the preview it isn't there, so the service fails at boot. The fastest way to make that red check go green is to unseal the variable, and then it's copied into every future preview like the ones on the left. The safe setting breaks the build; the unsafe one fixes it. That's an incentive pointing the wrong way.
There's no unseal button. Railway's docs say "Sealed variables cannot be un-sealed," so "just unseal it" in practice means replacing the sealed variable with an ordinary one holding the same live value. If a preview has already run with that value, rotate the key.
What to do with it
Don't fix this one variable at a time. Create a staging environment with its own database and test keys, then point PR environments at it in Project Settings, on the Environments tab. Previews then inherit staging values, sealed production secrets stay sealed, and nothing in the left-hand path is live. The full walkthrough is in Railway PR Environments: What They Copy From Production.
The Mermaid source
Copy this and swap in your own variable names.
---
title: "A PR preview gets every secret you didn't seal"
---
flowchart TB
U["Production, unsealed<br/><code>DATABASE_URL</code>, <code>sk_live_</code> keys"]
S["Production, sealed<br/><code>STRIPE_SECRET_KEY</code>"]
PR["PR environment<br/>public URL posted on the pull request"]
X["Preview crashes at boot<br/>quick fix: unseal it, so it gets copied too"]
U -->|"<b>copied in with live values</b>"| PR
S -.->|"never copied"| PR
PR -->|"reads the missing name"| X
classDef private fill:#ecfdf5,stroke:#10b981,stroke-width:2px,color:#1c1917
classDef public fill:#fef2f2,stroke:#ef4444,stroke-width:2px,color:#1c1917
classDef gate fill:#fffbeb,stroke:#f59e0b,stroke-width:2px,color:#1c1917
class U,S private
class PR public
class X gate
linkStyle 0 stroke:#ef4444,stroke-width:3px
Do Railway PR environments get my production variables?
Yes, unless you changed the base environment. Railway's guide says a PR environment replicates your entire base environment, including services, networking and variables, and the base is production by default. Every unsealed variable arrives with its live value.
Why is my sealed variable missing in a Railway PR environment?
Railway's variables docs say sealed variables are not copied over when creating PR environments. The name is absent, not empty, so code that expects it gets undefined at boot.
Should I unseal a variable so my PR previews work?
No. Unsealing it means the live value gets copied into every PR environment, on a public URL. Point PR environments at a staging base environment with its own test keys instead.
Where do I change the base environment for PR environments?
In Project Settings, on the Environments tab, where PR environments are enabled. Pick a staging environment you would be comfortable seeing copied onto a public URL.
What is your preview exposing?
Paste a Railway preview URL into a free scan and see exposed keys, open endpoints and missing auth before the branch ships.