PluginLoginBackend guarded the plugin method call but validated and later read the returned
VaultItemMeta outside it. A subclass or lazy accessor could raise there, and browser_vault list
copied that exception text into the model-facing result.
Validate and copy every returned field (metadata, passwords, codes, secret dicts) into
core-owned plain objects inside the same fixed-message guard.
VaultItemMeta does not type-check its fields, and browser_vault_list reads
them (len(meta.allowed_origins)) outside its per-backend guard, so one plugin
item with allowed_origins=None failed the whole listing, local vault included.
A fill_context() returning a non-context-manager raised AttributeError past
the PluginBackendError boundary (the attribute lookup ran before _call).
Plugin metas are now type-checked inside the plugin boundary (a malformed
list or meta is the plugin's fixed-text error), and fill_context's factory and
__enter__ lookups run inside _call. Review: Greptile on #143964.
A password-manager plugin registered with ctx.register_login_backend shares
browser_vault with the Hermes vault, 1Password and Bitwarden. On the branch
head the core consulted the plugin's own owns() (a greedy plugin received
op:/bw:/other plugins' handles), listed whatever ids the plugin returned
(spoofed vault_/op: handles), let a second plugin take over a registered
name, let a needs_unlock plugin drive the Hermes master-password prompt under
any label, read name/prefix through properties that can change after
validation, and copied plugin exception text into the model-facing list result.
Every plugin backend now reaches the vault tool only through a core-owned
PluginLoginBackend (agent/vault_backends/plugin.py):
- namespace is "<registry key>:"; ownership is decided by the core, items and
metas outside it are dropped, resolve_* refuse foreign handles;
- the plugin gets the handle and nothing else; needs_unlock is always False;
- plugin exceptions and wrong-typed values become a fixed-text
PluginBackendError raised outside the except (no chained context).
Registration refuses descriptor name/prefix, prefix != "<name>:", built-in
names and prefixes (derived from the built-in classes), held names, and
needs_unlock. The fill wrapper turns only PluginBackendError into a typed
refusal, so built-in fills behave as before.