Seal Sealed values in the browser (SL7) #3304
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3304"
general
weight: 0.35
nick-potts
SL7 of Sealed variables level A.
Summary
While an Organization has sealed variables on, the dashboard seals each Sealed value in the browser before the write leaves the page. The Config Store receives ciphertext for the Service it lands in and stores it as it came. No daemon is involved. With the flag off, the dashboard sends trunk's legacy write byte for byte, and no real Organization has the flag, so nobody notices yet.
What ships.
modules/variables/seal-value.ts(not.client., which TanStack Start keeps out of the server build): RFC 9180 base mode, DHKEM(X25519, HKDF-SHA256), HKDF-SHA256, ChaCha20-Poly1305, infoployz-sealed-v1, wireenc ‖ ctin base64. AAD binds Organization id, Environment, Service and key.@hpke/core,@hpke/chacha20poly1305and@hpke/dhkem-x25519joindashboard/package.json.store-writegains a lazyprepare, so a mutation seals at submit time and its optimistic cache only ever holds a redacted change.useSealingbinds the sealer to the key from the same fresh read.- The add form, the row's Set value and the edit seal.
- In the raw editor, a line ticked Sealed goes Sealed, as a create or an update, even when another tab made its key plain while the editor was open. A Sealed variable it omits is never a delete.
- Sync and On merge seal for the receiving Service, read afresh at the moment of each send. In a Sync, a Service that is new there arrives as Not set, with "Set this value after syncing." An On merge Edit for such a Service is refused with "Set this value after merging." and reopens on what was typed.
- Any refused Sealed write keeps what was typed: the add form, the row edit, the raw editor and On merge reopen on it.
core/crates/ployzd/src/sealing_key.rsgains a test that opens a vector sealed byseal-valuewith the daemon's opener. This is the only change outsidedashboard/anddocs/user/.docs/user/services/variables.md,environments/environments.mdandenvironments/preview-environments.mdeach gain a line that holds whether sealing is on or off. None of them promise sealing.The first commit, 686f82827 ("Read whether an Organization seals on the client, and to which key"), is SL8's shared reader, and it matches SL8's byte for byte. Whichever PR merges second drops it.
Bets
readSealingFnreturns only a public key and an Organization id.Rulings carried
Known gaps
fetchQuery({staleTime: 0})can join a read already in flight that began just before submit. The window is one request's round trip. It is the same class of race as the one above.set_merge_valuecarries no id, so a retried On merge seals again instead of reusing the first ciphertext.branch/sync.rsrequest.id == found.last_sync). So a Sync that landed is answered, not run twice, and one that didn't runs once with the new body. A legacy Sync that landed stays legacy: sealing was off when it was sent. A refused Sync rolls back, so its next try seals afresh.JSON.parse's message, which quotes the text ("{"E":rvw1234}" is not valid JSON), and session replay recorded it. Plain values leaked this way on trunk too. The error is now "Invalid JSON.", with the line and column only from V8's closing(line L column C), never from the quoted text, so plain and sealed values are both covered. The.envpath already named only the line.{secret}the Store seals, keeps U+FFFD in its place: the Store takesabc\uD800defand savesabc\uFFFDdef(probe throughwriteStoreAsMemberand the native SDK, read back fromconfig_environment.working). A browser-sealed value refuses it with "A value can't hold an unpaired surrogate.", since the browser's UTF-8 would seal U+FFFD in place of what was typed. Trunk's plain behaviour is unchanged.Evidence
At 3181726e2, rebased on main 67025ee3e (#3098). The 31 commits keep their patch-ids. One commit on top gives the cluster-sealing test's key report
AppConfig, which recording a Sealing Key reads since #3098; the reader is unchanged. The postgres tests for cluster sealing, store variables, the agent runner and organization ownership pass (30).pnpm typecheckand oxlint on the changed files are clean. Vitest passes for-components/sync,src/modules/variables, store-variables, the raw editor anddata-boundaries.static.test.ts.pnpm buildexits 0.Unit, at e341d3a5a.
tsc --noEmitandpnpm lintare clean.src/modules/variables, Sync and On merge, the raw editor andsrc/components/variables.-
--project unitonseal-value.test.tsplussrc/modules/agent: 191 tests.-
--project postgresonstore-variables.postgres.test.tsplussrc/modules/sealing: 4 tests.ployzdsealing_key::tests::a_value_the_browser_sealed_opens_only_for_the_variable_it_was_sealed_asopens the vectorseal-valuesealed.ployzddoesn't build on macOS (inotifyneeds kcmp), so this test runs only in CIrust-tests, where it passes (daemon shard, e341d3a5a). real-wait-lint, run locally as rust-lint runs it, exits 0.RECIPIENT_PRIVATE_KEYinseal-value.test.ts. That key is a test vector shared with the Rust test and seals nothing real. It needs to be marked a false positive in GitGuardian, and it isn't a required check.Parity: the Store's checks on a plain value, and where a browser-sealed value meets each. The Store can't read ciphertext, so
sealedValueProblem(seal-value.ts) runs before sealing.| Store check on a plain value | Browser-sealed value |
| --- | --- |
| Key: at most 128 characters, letters, digits and
_, not starting with a digit, uppercased (VariableKey::parse) | Moot: the key stays cleartext, and the Store parses it on every path || Reserved names (
refuse_reserved) | Moot: the Store, every path ||
PORT| Refused in the browser, and by the Store (client_sealed::accept,refuse_port) || Null character (
validate_text) | Refused in the browser || 128 KiB including the name (
too_long) | Refused in the browser, and by the Store from the ciphertext's length || Empty secret (
{"secret": ""}refused) | Refused in the browser. Add waits for a value rather than calling an empty field a problem || Unpaired surrogate | The plain path saves U+FFFD (see Known gaps). Refused in the browser |
|
${{references, unterminated or unresolved | Plain only. A sealed value is stored as typed, so the browser refuses${{|| Multiline rows under 6 characters | Refused in the browser, and by the Server at deploy (
sealed_env.rs) || Typed address hints | Advisory, not a refusal. None for ciphertext |
| Environment, Service and key binding, Shared scope, flag on | The Store (
client_sealed::accept) |Regression tests for the swarm findings at e341d3a5a. Each was seen failing before its fix.
prepare's output carries the plaintext.sealedValueProblemrefuses a null character, an empty value and an unpaired surrogate, and takes a surrogate pair.agent-gate.test.tsdrivesrunGatedwith a gated Store write carrying a browser-sealed value, a secret's value as text, and a sealed value in a Sync. Each is refusedinvalid_argumentand the Store is never opened. With the refusal nulled, all three reach the Store. No compiled gated tool writes a secret today, so only a direct drive reaches this seam.variable-raw-editor.test.tsgives{"E":rvw1234}, the textline 7 column 8, a missing comma and a raw newline in a string, and asserts each exact message. With the fix reverted, the first receives the value in its text. With the position matched anywhere in the message,line 7 column 8shows the user's digits as the position.branchandon_mergeswapped and its pin failed (2 of 8 parallel runs).anyOrderShowssortsshowson both sides of the On merge and Sync pins. Every other byte stays pinned. 16 of 16 pass under the same load.COMMAND_FILES: "an On merge Edit shows at once; the row watches its answer only to reopen a refused Edit on what was typed".Regression tests for the interrogate findings.
offorno_serverbefore submit. The box stays ticked and the edit never shows the plaintext. This test was seen failing on the old code first.lineage:variables.KEY). A non-variable row throws. The value is dropped or refused when its Service is missing.Live, verify-dashboard.
sealedVariablesset only for the lane-created test Organizationada(009b6cda-0d8a-4965-ae7a-7ab6ea6b94b8) in the throwaway verify Postgresployz-verify-eb0fe4baf7, with a locally generated test key.no-server.png,seal-dialog.png,staged-sealed.png.sealedForciphertext and no plaintext. Trunk sends{secret: value}as before.Perf.
Media
Recorded at 3e0f1ce20 by the swarm's media lane, in
/tmp/swarm-3304/media/(WebM flow, PNG end state).1.
flow1-add-sealed.webm/.png: add a sealed variable.2.
flow2-set-value.webm/.png: set a value on a Not set row.3.
flow3-seal-from-menu.webm/.png: seal a plain variable from the row menu.4.
flow4-raw-editor.webm/.png: the raw editor, and its JSON error with a position and no typed text.5.
flow5-branch-sync.webm/.png: a Branch Sync, with one value arriving Not set.6.
flow6-no-server.webm/.png,flow6-no-server-seal-menu.png: with no Server, the add dialog greyed out and the menu seal's toast.Merge Danger
Door: two-way
The legacy path is unchanged. The only new behaviour runs while an Organization has
sealedVariables, and no real Organization does. Reverting the PR leaves stored ciphertext the Store already accepts from SL2's CLI path.Blast Radius: variables
Every variable write now goes through
prepare. A bug there would block saves, not corrupt them, because a refused seal keeps what was typed and never falls back to plaintext while the flag is on.