Repository navigation
Conversation
Adds the `includePlugins` content flag (on by default) and the shapes of the `agent-plugins/` sidecar: BackupPluginEntry (name, git source, pinned commit, install method, imported components), its manifest, and the preview/restore rows with a missing/installed/conflict status. The entry parse drops every local trust field (consent, install times, auto-update), so a hand-edited list cannot carry consent to another machine.
A push writes `agent-plugins/manifest.json`: each managed plugin's git source, the pinned commit, its generated-plugin method and its component selection. It carries no consent, install times or auto-update. The file joins the push's secret scan and size budgets, and a row that the restore side would refuse is left out of the list instead of failing the push. Preview and restore read the list, validate it before the safety snapshot (INVALID_BACKUP when malformed), and report each plugin as missing, installed or conflict against this machine's registry. They write nothing for plugins: a restore cannot give the consent an install records. With `includePlugins` off the list is only checked for existence and reported as skipped.
A new `install-from-backup` section intent opens the Add plugin panel on a queue of backed-up plugins. Each one previews at its pinned commit through the normal consent review, preselects the components the backup kept (limited to what the preview still offers), and installs with the backup's branch or tag as its tracked ref, so it sits at the pinned commit and still offers updates. Install and Skip both move to the next plugin. After the last the panel closes, and the list refreshes when anything was installed. A preview that fails shows its error with Skip. The source form moves into its own component. That keeps AddPluginPanel's complexity below what it was.
… → Backup Adds an "Agent plugins" row to what a backup carries (on by default, Ctrl+Alt+X). After a preview or a restore, a "Plugins in this backup" card lists each plugin's repository, ref and pinned commit with its status on this machine. "Review and install (N)" (Ctrl+Alt+Y) publishes the missing plugins as an `install-from-backup` intent and opens Settings → Plugins. A restore still installs nothing: each plugin goes through its own install preview. The card is its own component so BackupSection's complexity does not grow. BackupSection now reads the settings context to navigate, so its two test trees mount SettingsProvider. The story has a play test and no Pixel snapshot (the snapshot budget is at its cap); the card's 375px layout was checked by hand.
make lint-eslint (type-aware) rejects `await expect(p).rejects` under bun:test types. Check existence with a helper instead.
…alizer The section consumed the buffered intent inside a useState initializer. StrictMode runs that initializer twice and keeps the second result, so in the dev app a palette command or the backup "Review and install" opened Settings → Plugins without the panel it asked for. The initializer now only reads the buffer, and the buffer clears when the section subscribes.
The plugin list is advice, so a malformed manifest, an unknown schemaVersion, a symlinked or missing list file, or one row this build cannot read (a future source type) no longer fails Preview or Restore with INVALID_BACKUP. The reader keeps each row it can parse, leaves out the rest and reports every case in a new optional `pluginListWarnings` field on preview and restore. A local disk failure still throws. Settings → Backup shows the warnings in the plugins card, also when no row could be read. Signed-off-by: Thomas Kosiewski <tk@coder.com>
A restore installs nothing, so a push from a new host before the user reinstalls rewrites the backup's plugin list from the local installs alone. Preview and restore now report `pluginsDroppedByPush`: the listed plugins that this machine's export would not include. Settings → Backup shows them in a warning beside "Back up now". Push semantics are unchanged. Signed-off-by: Thomas Kosiewski <tk@coder.com>
…pinned commit installSource kept the backup's ref only when the previewed URL equalled the backup's URL. It now keeps it when the preview resolved the pinned commit (a commit preview with the same locked SHA). A user who fixed the URL (ssh to https) for the same commit keeps the tracking, and a user who edited the ref to another branch or commit records what that preview resolved instead of a ref that describes a different checkout. Signed-off-by: Thomas Kosiewski <tk@coder.com>
Signed-off-by: Thomas Kosiewski <tk@coder.com>
A listed plugin's lockedSha must be a full 40-hex commit id (the shape isFullCommitSha accepts), and its source URL must not start with "-", which git would read as an option. The list is repository-controlled, and the reinstall preview hands both values to git. A row that fails either check is left out of the list with a warning, like any other bad row. Signed-off-by: Thomas Kosiewski <tk@coder.com>
Adds a section to the plugin docs: what the backup keeps (URL, tracked ref, pinned commit, folder, install method, component choice), that a restore installs nothing, how to reinstall each plugin through the install review at its pinned commit, the push warning, and what happens when the list cannot be read or the option is off. Signed-off-by: Thomas Kosiewski <tk@coder.com>
Signed-off-by: Thomas Kosiewski <tk@coder.com>
… guards Each of these fixes survived a mutation in review: the restore pass-through of pluginsDroppedByPush, the oRPC output fields (oRPC strips keys the schema does not list), the symlinked sidecar folder guard, and the warning cap. The repository URL guard now also refuses leading whitespace, which the preview trims before handing the URL to git. The docs say the push warning names only the plugins Xum could read from the list.
The push now compares the checked-out backup's plugin list with the one it writes. A listed plugin the export leaves out, or the whole list when the push writes none (flag off, nothing installed, unreadable local registry), fails with PLUGIN_REMOVAL_APPROVAL_REQUIRED and an approval digest, like the secret scan. The Backup section shows a card with Back up and remove. This replaces the preview-only warning, whose state was lost when the section unmounted and which never covered a flag-off push. Signed-off-by: Thomas Kosiewski <tk@coder.com>
BackupPluginReportSchema (rows, skipped, warnings) is defined once and nested as a required plugins field on both outputs. The node and browser types are inferred from it, so the hand-typed PluginBackupReport, the four copies of the fields and the field-by-field forwarding in BackupService are gone, and so is the output-schema test that only guarded the duplicated wiring. The row type is BackupPluginRow (a restore installs none of them) and the status type BackupPluginStatus. Signed-off-by: Thomas Kosiewski <tk@coder.com>
The reader checks the envelope and each row on its own (agentPluginBackup.ts), so BackupPluginManifestSchema, with its max and duplicate-name refine, only ever ran in its own tests. BackupPluginManifest is a plain interface now, and the schema tests point at BackupPluginEntrySchema. Signed-off-by: Thomas Kosiewski <tk@coder.com>
Another machine cannot use a path or file URL on this one, and the list would publish it (the home folder names the user). The export reuses the marketplace code's local-source check and logs each plugin it leaves out by name. Signed-off-by: Thomas Kosiewski <tk@coder.com>
The list is repository-controlled and a restore hands each URL to git. The URL now also refuses a UNC share (//host or \\host, which Windows opens over SMB), whitespace, control and bidi characters, and a credential. The whitespace and control check is shared with sanitizeBackupGitRemote, which now drops bidi controls too. importedComponents holds at most 512 names of 256 characters, method.entry has the same cap, and method takes only the two kinds an export writes. The commit-id comment no longer claims isFullCommitSha's shape. Signed-off-by: Thomas Kosiewski <tk@coder.com>
…gin backup copied - registry.ts owns the lenient registry parse (first row per name, unreadable rows skipped); installService and the backup both call it. - lstatIfExists replaces the catch-all lstat calls, so an unreadable plugins folder or sidecar fails the preview instead of reading as missing. - formatZodIssues formats a row's issues. - isFilesystemError accepts errno codes only: BackupInvalidPayloadError and BackupServiceError carry a string code too. - The sidecar manifest serializer and the sidecar existence check are shared with the project bundle, whose copies were byte-identical. The shelf's copies differ (they swallow every error) and stay as they were. - validateRestore reads the plugin list only, not the registry comparison. - The unsafe-URL pattern is a constant, not a one-line predicate function. Signed-off-by: Thomas Kosiewski <tk@coder.com>
Signed-off-by: Thomas Kosiewski <tk@coder.com>
- The install-from-backup intent carries entries (the source and the pin), not the rows with the status that only chose which of them to offer. - agentPluginBackup.ts calls the Xum root muxRoot like its neighbours, and unreadableList no longer shares the word skipped with the flag-off case. Signed-off-by: Thomas Kosiewski <tk@coder.com>
…of threading a queue through it BackupInstallQueue holds the index and renders one AddPluginPanel per plugin, keyed by the index, with the backed-up plugin as its seed. The panel fills its fields from the seed in its state initializers and previews it in one mount effect that depends on the API (so a first preview is not lost when the API arrives late) and drops the result of an older run. The plain add path calls onInstalled and onClose directly again. One predicate, "this preview is the backup's pinned commit", gates both the kept ref and the preselected components, and the backup's ref is kept only for a branch or tag row. One addPanel state and one intent decoder replace addOpen, addSession and the two exported decoders. useStartFirst, startBackupItem, NO_PLUGINS, the item null mode and the empty-list case are gone. Signed-off-by: Thomas Kosiewski <tk@coder.com>
Signed-off-by: Thomas Kosiewski <tk@coder.com>
Signed-off-by: Thomas Kosiewski <tk@coder.com>
…quoting them The Backup section never calls install, so asserting it did not is vacuous: the contract (a restore installs nothing) is tested where the restore runs, in agentPluginBackup.test.ts. The oversized-list test checks the numbers its summary lines carry, not their wording. Signed-off-by: Thomas Kosiewski <tk@coder.com>
…no lint exception Signed-off-by: Thomas Kosiewski <tk@coder.com>
Signed-off-by: Thomas Kosiewski <tk@coder.com>
Signed-off-by: Thomas Kosiewski <tk@coder.com>
…s rows in the common table Five rows from c6defbd785 now also sit in the reviewUrlOf table (an ssh URL that ends in an https URL turns red when the ^ anchor of PLAIN_HTTPS_URL is dropped). The code comment, the plugin docs and the built-in skill state the DNS limit: a host name that DNS points at this machine still passes, as it does for a remote marketplace's sources, and the preview contacts it over https with nothing installed without consent. AGENTS.md says a check of repository-controlled plugin rows reuses the installer's rules.
main's tree for every conflicted file equals PR head 7efe4c8, so the conflicts keep this branch's side.
…what the list cannot hold An allowed %20 right before a literal token (or inside a private key header) kept the raw publish-time scan from matching, so a push listed the token. The export now decodes the escapes of each entry (up to three levels, a malformed escape counts as a match) and runs the same patterns on the result. A flagged plugin is left out and logged by name. A plugin the installer takes and the list refuses (a ref such as refs/team or with a bidi mark, a URL over 2048 characters, a folder over 1024, more than 512 imported skills) was a failed push for every settings backup. It is left out and logged by name and field too, and one that was listed before still asks for the removal approval.
… and say format characters A token escaped twice (%2567hp_) passed the escape check, which saw only the %25 of the first pass. percentDecodedForms now decodes up to four levels (a malformed escape or a fifth level counts as a match), and both the escaped-unreserved check and the secret scan read every form. The ref rule of the list was the rule of a branch name, which refused refs that real git holds and the installer clones (HEAD, refs/foo, refs/team, -x). It now refuses only what git cannot hold, whitespace, control and format characters, and an abbreviated commit id. A plugin the list refuses is left out and logged by name and field. The log line and the docs say format characters (a bidi mark, a zero-width space) next to whitespace and control characters.
…text it is written as JSON writes a control character as an escape (\n, \t, \u0001), so an MCP server name of a newline and a token had no word boundary in the file the publish-time scan reads, and a real push published it. The export now checks every string of the entry, values and keys at any depth, as it is and with its percent escapes decoded (jsonValueHidesSecret), and leaves such a plugin out and logs its name. The comment on PLAIN_HTTPS_URL and the plugin docs now say a review's https preview uses a credential that git or ~/.netrc holds for the host (a netrc default entry matches every host), and that it starts only after the user selects Review and install.
…d pin the backslash in a review path The per-string secret check left out a plugin whose URL held a literal token, so the push review that the scan opens for such a file (SECRET_DETECTED) never ran. A string now counts as hidden only when its JSON text does not match a pattern and the string itself, or its decoded form, does. PLAIN_HTTPS_URL tests refuse a backslash in the path, and a mutant that allows one turns them red.
…ur escape passes
A scan of only the last decoded form, a {7,20} abbreviated commit id range, and an escape cap of 3
or 5 passed every test. Each now turns a test red: a token visible only in an earlier decoded form,
39-, 38- and 21-digit refs, and a space escaped four times (let through) against five (a match).
The docs also name a token behind a control character in any list field as a leave-out reason.
…h is remote, not on this machine The backup's wider drive rule (any character and a colon) is the safe side when a source is left out, but the marketplace check used the same predicate to grant rights. A marketplace at `h:org/mkt.git` (ssh to host alias h on Linux and macOS) then counted as local and could name ssh sources and local paths. surelyOnThisMachine keeps main's drive rule for that check. Also stop exporting MAX_ESCAPE_PASSES, which nothing imports.
…s platform Red before the fix: a drive counts on Linux and macOS, a host Xum cannot read counts as this machine, an scp user part with a colon hides the host git signs in to.
…this platform surelyOnThisMachine takes the platform: a drive counts only on win32, where git reads it as a path. A host that Xum cannot read as git does (an unreadable port, a user part with a colon, a # or an @[ that moves the host) grants nothing.
…mote # Conflicts: # src/common/utils/agentPluginSource.test.ts # src/common/utils/agentPluginSource.ts # src/node/services/agentPlugins/claudeMarketplace.test.ts # src/node/services/agentPlugins/claudeMarketplace.ts
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
Security findingsFinding details are still loading. Check the individual review comments. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🟢 e2e stories (Haiku): 14 passed22 agent steps · 7 replayed from cache · 15 model calls · 47.0k tokens (23% cached) All 14 tests in 9 files
e2e 0.20.0 · 1m 20s · web · run artifacts 🟢 e2e Electron stories (Haiku): 3 passed3 agent steps · 3 model calls · 7.9k tokens (22% cached) All 3 tests in 3 files
e2e 0.20.0 · 24.7s · electron · run artifacts 🟢 e2e agent repros (Haiku): no tests selectedSpend: $0.00 of the $1.00 cap (proxy ledger) e2e 0.20.0 · 7.9s · 2 targets (web, phone) · run artifacts |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7788a53bd6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… as a path Red before the change: a loopback marketplace counts, escapes that git decodes hide a host from the shape check, and Git for Windows reads C:market as a drive.
…s a path No host counts, loopback included: git decodes a scheme URL and moves the host at an @[ before it reads it, so a shape check on the host can grant rights to a host that git never reaches. Git for Windows reads one ASCII character and a colon as a drive, with or without a slash.
…path A drive counts on Windows only for an ASCII letter and a colon followed by a plain path (no colon, wildcard, reserved device name or name that ends in a space or a period). A Windows network share counts as another machine. The docs sentence says the final rule.
…ackslash separators
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: de9753ae7c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return /^[a-zA-Z]:[\\/]/.test(url) || (!/^.:/su.test(url) && pointsAtThisMachine(url)); | ||
| export function surelyOnThisMachine(url: string, platform: NodeJS.Platform): boolean { | ||
| const windows = platform === "win32"; | ||
| if (url.startsWith(windows ? "file:///" : "file://")) return true; |
There was a problem hiding this comment.
Reject UNC paths hidden inside file URLs
On Windows, file:////attacker/share/market.git passes this prefix check even though Git opens its //attacker/share path as a UNC network share; the repository already identifies this exact spelling as a share in src/common/orpc/schemas/backup.test.ts:95. An SMB-hosted marketplace is consequently granted local-marketplace rights and can name machine-local or arbitrary SSH sources, bypassing assertMarketplaceMayName; inspect the file URL pathname and reject UNC paths before returning true.
Useful? React with 👍 / 👎.
Why
A Claude Code marketplace "on this machine" may name local paths and ssh sources. A remote marketplace may name only https sources (
assertMarketplaceMayName). A verifier raised this on #8036, and main already had it:surelyOnThisMachinegave local rights to URLs that git sends to a remote host.C:/repos/market,h:/org/market.git). Git for Windows reads it as a drive. Git on Linux and macOS reads it as ssh to the hostCorh.ssh://evil.example:+22/market.git,ssh://[fe80::1%25eth0]/market.git,ssh://evil|host/market.git). The old code counted it as this machine.Codex and two verifiers then showed that every check that reads a host before git does fails the same way. Git decodes a scheme URL first, so
ssh://localhost/y%40%5bevil.example%5d/xsigns in toevil.example. An@[anywhere in the URL moves the host.127.evil.examplestarts like a loopback address. A port over 65535 stays part of the host name that git hands to ssh. Each fix for one spelling left another.What changed
A marketplace gets local rights only when git reads its URL as a path on the platform Xum runs on. No host counts, so a marketplace at
localhostor another loopback address is now remote for this check. That is a narrowing: it can still name https sources, as any remote marketplace can, but it can no longer name a path on this machine or an ssh source.surelyOnThisMachine(url, platform)takes the platform (common code cannot readprocess.platformin the browser, soclaudeMarketplace.tspasses it). It answers yes in these cases only:file://in lowercase. On Windows it must start withfile:///, because Git for Windows readsfile://server/shareas a share of another machine.url_is_local_not_ssh): the URL has no colon, or a/before its first colon. This holds on every platform. A rooted backslash path has no rule of its own, so\h:org/market.git,\\h:xand\\?\C:\repos\marketare scp URLs and count as remote.A-Z a-z 0-9 . _ space ( ) -and the two separators. No name may be a reserved device name (con,prn,aux,nul,com0–com9,lpt0–lpt9, with or without an extension) or end in a space or a period (.and..are fine). This coversC:\repos\market,C:/repos/marketand the drive-relativeC:market. It refusesh:/org/market:archive.git,h:/aux/market.git,h:/org/market*.gitandC:\a:b.//server/share,\\server\share) is a network share, so it counts as remote there. On Linux and macOS it is a path.pointsAtThisMachine,gitUrlHostand every caller that only refuses or leaves out keep their behavior. The docs sentence indocs/agents/agent-skills.mdxstates the rule (the built-in skill is regenerated).Tests
describe("surelyOnThisMachine")inagentPluginSource.test.tshas 82 tests. They cover local on every platform, local except on Windows (shares), local on Windows only (drives), remote after a drive, each device name, every excluded character, and remote on every platform for hosts. The hosts include each URL that Codex and the two verifiers raised.claudeMarketplace.test.tsruns the same cases throughresolveEntrySourceonlinux,darwinandwin32(it switchesprocess.platform). A remote marketplace must still name https sources.7788a53bd6): 51 of the 229 tests in the two files fail there. They all pass on this head.pointsAtThisMachine, a loopback host that counts again, and the platform argument of the caller. Every mutant turns at least one test red.GIT_ALLOW_PROTOCOL=ssh:file, no network). For every URL that the function counts as local, git runs no ssh. Corpora: 57,006 strings and templated URLs (14,021 counted as local), the verifier's 7,754 URLs (54 counted), and 58,315 random token strings that the function counts as local. Zero URLs reached ssh. An earlier head with the same Linux logic had 146,509 more with zero. This does not cover Windows: I read the Git for Windows source (url.c,path-utils.c,mingw.c,connect.c) and did not run it there.de9753ae7c:make static-checkandmake lint-eslint: exit 0.make crap-check: PASS, 0 violations, 0 warnings.make dry-check: PASS (3 changed functions, 15,627 compared).bun testonsrc/common/utils: 2,518 pass, 0 fail (127 files).bun testonsrc/node/services/backup: 601 pass, 0 fail (8 files).bun testonsrc/node/services/agentPlugins: 1,147 pass, 1 skip, 0 fail (41 files). On the earlier head7788a53bd6, two runs of this folder each had one failing test,a pass starts no logout after its deadline (#6627), at a host load average between 50 and 100. This PR does not touch that code. The test uses a 20 ms deadline that starts before the pass reads a file, so a slow read can leave no time for the first logout. I did not prove that with a trace.Not in this PR
gitUrlHostmisreads an scp URL with a colon in the user part on the refusal path.pointsAtThisMachine("localhost:a@evil.example:x")returns false, but git signs in tolocalhost. A remote marketplace still cannot name it, because it is not https. The backup leave-out and the schema check would not catch it. This is the next follow-up PR.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$257.92