Repository navigation
fix(browser): bound import's key derivation parameters and report what remove cannot check - #249
Merged
Merged
Conversation
… writes turno-browser import took scrypt N up to 2^20, r up to 32 and p up to 16 from the file header, and derives the key before the tag can be checked. It now takes r 8 and p 1, as export has always written, and N at most 2^17, so an import costs no more memory than an export. A header outside these bounds is refused as damaged before any key is derived.
turno-browser remove listed nothing and exited 0 when it could not check part of an identity. It now lists each such case under left with "unchecked": true and exits 1: an agent config file it cannot read or parse (unless its text does not hold the server's name), a registration init recorded in a file the agent's own command does not change, an identity.json or vault index it cannot read (kept, since they name the secret store items), and a turno-browser-mcp started with the identity's id whose environment cannot be read. An agent file that cannot be read after the agent's mcp remove counts as failed. The final check uses lstat for paths, so an error other than "not there" is not taken for gone, and checks failed items again. The help states the limits: vault credentials are found through the sites the vault index names, and session exports through the record kept since 0.9.0.
…move keeps A broken agent file is now skipped only when no quoted key names the identity's server, so browser-school-laptop no longer counts for browser-school, and agent files are read with comments and trailing commas allowed (Gemini CLI reads its settings.json with comments). Planning uses lstat, so a broken link at an identity path is planned and checked. A secret another identity's identity.json or turno's mcp.toml may use is kept and listed as unchecked when that file cannot be read. When the final check has no process table, the processes the plan could not tell apart stay listed.
william-monroy
force-pushed
the
fix/browser-remove-import
branch
from
December 3, 2026 17:28
16ea6a5 to
51fe05f
Compare
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.
Summary
Two turno-browser patches.
Import: a bound on the key derivation parameters
importread scryptN(up to 2^20),r(up to 32) andp(up to 16) from the file header and derives the key before the GCM tag can be checked, so a header could ask import for far more memory than export ever uses. Export has always writtenN2^17,r8,p1 (checked in the history ofsealed.tssince it was added in #74). Import now takesr8 andp1 only andNat most 2^17 (and at least 2), so its cost is at most export's (about 128 MiB). A header outside these bounds is refused as damaged inparseEnvelope, before any key is derived. Every file export has written still imports. The comment on the ceiling now says what the code does, and the moving-a-session page states the bound.Remove: say what could not be checked
removeno longer reportscomplete: trueand exits 0 while it could not check something. Each such case goes underleftwith a new item field"unchecked": true(additive: the top-level--jsonfields are unchanged), shown as "could not check" in the plan and "not checked" after the run, and the exit code is 1."browser-school", notbrowser-school-laptop) cannot hold the entry, so it is not listed (otherwise any broken agent file would make every removal incomplete). Agent JSON files are read with comments and trailing commas allowed: Gemini CLI reads its settings.json withstrip-json-comments; Claude Code, Cursor and Copilot CLI write plain JSON, and a lenient read only finds more of what is in a file. After an agent'smcp remove, a file that cannot be read counts as failed, not deleted, in the step and in the final check.SecretStorehas no listing, and adding a prefix listing is not done here: the macOSsecuritytool has no prefix query (only a dump of every item in the keychain), and libsecret's search matches attributes exactly. So the limit is stated in the help and the reference. Whatremovecan do is not lose the names: an identity.json or vault index that exists but cannot be read is now kept and listed as unchecked (deleting it would lose the names of the secret store items), so a later run, once it is readable, finds and removes them.lstat, so a broken link at an identity path is planned and checked, and an error other than "not there" counts as still there.The help text of
remove(and so the generated reference pages) describes the unchecked cases and the limits.Tests
Only the touched files:
test/sealed.test.ts(header withN2^18 and 2^20,r4, 16 and 32,p2 andN1, written by hand and refused as damaged with no key derived) andtest/cli/remove.test.ts(broken agent file, unreachable registration, unknown-environment process with a fake process table, unreadable identity.json and vault index kept and removed on a later run, a broken file naming onlybrowser-school-laptop, a commented Cursor file, a failed item that is gone moving to deleted). Scratch HOME, fake secret store and fake agent commands throughout.Also run: typecheck, Biome, knip,
scripts/no-em-dash.mjs,scripts/changeset-names.mjs,docs generate:check.