877d99382447

restrict content entry writes (v5.3.18)

time
2026-11-16 00:45 UTC · 1 week ago
machine
Junes-MacBook-Pro.local
agent
gpt-6
session
remediate interim audit findings
parent
d2c0f674ea72
7 files manifest.firefox.json+1 −1manifest.json+1 −1package.json+1 −1src/background/messages.entry-write-origin.test.ts+214 −0src/background/messages.ts+69 −8src/content/content.selector-ui.test.ts+31 −1src/content/inject.ts+5 −17
manifest.firefox.json+1 −1
@@ -1,7 +1,7 @@11 {22   "manifest_version": 3,33   "name": "Peach Password Manager",4-  "version": "5.3.17",4+  "version": "5.3.18",55   "description": "Zero-knowledge password manager",66   "browser_specific_settings": {77     "gecko": {

view file

manifest.json+1 −1
@@ -2,7 +2,7 @@22   "manifest_version": 3,33   "minimum_chrome_version": "116",44   "name": "Peach Password Manager",5-  "version": "5.3.17",5+  "version": "5.3.18",66   "description": "Zero-knowledge password manager",77   "action": {88     "default_popup": "src/popup/index.html",

view file

package.json+1 −1
@@ -1,6 +1,6 @@11 {22   "name": "peach",3-  "version": "5.3.17",3+  "version": "5.3.18",44   "description": "Zero-knowledge password manager",55   "license": "GPL-3.0-only",66   "type": "module",

view file

src/background/messages.entry-write-origin.test.ts+214 −0
@@ -308,4 +308,218 @@308308     expect(res).toMatchObject({ ok: false, error: "entry_not_found" });309309     expect(vault.getEntryById(entry.id)?.additionalUrls ?? []).toEqual([]);310310   });311+312+  it.each(["ADD_ENTRY", "UPDATE_ENTRY"] as const)("PB-26-944: %s rejects protected own keys even when undefined", async (type) => {313+    const entry = await addLegitEntry();314+    const before = structuredClone(vault.getEntries());315+    for (const key of ["id", "notes", "totp", "totpAlgorithm", "totpDigits", "totpPeriod", "passkey", "canary", "passwordHistory", "passwordChangedAt", "breach", "tags", "createdAt", "modifiedAt", "deletedAt", "cardNumber", "unexpected"]) {316+      const fields = type === "ADD_ENTRY"317+        ? { title: "Page draft", url: LEGIT, [key]: undefined }318+        : { [key]: undefined };319+      const payload = type === "ADD_ENTRY" ? fields : { id: entry.id, patch: fields };320+      const res = await messages.handleMessage({ type, payload }, pageSender(LEGIT));321+      expect(res, key).toMatchObject({ ok: false, error: "invalid_payload" });322+      expect(vault.getEntries(), key).toEqual(before);323+    }324+  });325+326+  it.each(["ADD_ENTRY", "UPDATE_ENTRY"] as const)("PB-26-944: %s rejects malformed allowed values without mutation", async (type) => {327+    const entry = await addLegitEntry();328+    const before = structuredClone(vault.getEntries());329+    for (const fields of [330+      { title: 7 }, { username: false }, { email: {} }, { password: ["secret"] }, { url: 42 },331+      { title: undefined }, { username: undefined }, { password: undefined }, { type: undefined },332+      { additionalUrls: undefined }, { additionalUrls: "https://example.com" }, { additionalUrls: [LEGIT, 42] },333+    ]) {334+      const draft = { title: "Page draft", url: LEGIT, ...fields };335+      const payload = type === "ADD_ENTRY" ? draft : { id: entry.id, patch: fields };336+      const res = await messages.handleMessage({ type, payload }, pageSender(LEGIT));337+      expect(res).toMatchObject({ ok: false, error: "invalid_payload" });338+      expect(vault.getEntries()).toEqual(before);339+    }340+  });341+342+  it.each([undefined, "", "example.com", "not a URL", "ftp://example.com/file", "javascript:alert(1)", "https://"])("PB-26-944: ADD_ENTRY requires a valid primary HTTP(S) URL: %s", async (url) => {343+    const res = await messages.handleMessage({344+      type: "ADD_ENTRY", payload: { title: "Page draft", url, additionalUrls: [LEGIT] },345+    }, pageSender(LEGIT));346+    expect(res.ok).toBe(false);347+    expect(vault.getEntries()).toEqual([]);348+  });349+350+  it.each(["", "example.com", "ftp://example.com/file", "javascript:alert(1)", 42])("PB-26-944: ADD_ENTRY rejects every invalid additional URL: %s", async (extra) => {351+    const res = await messages.handleMessage({352+      type: "ADD_ENTRY", payload: { title: "Page draft", url: LEGIT, additionalUrls: [LEGIT, extra] },353+    }, pageSender(LEGIT));354+    expect(res.ok).toBe(false);355+    expect(vault.getEntries()).toEqual([]);356+  });357+358+  it.each([undefined, "", "example.com", "ftp://example.com/file"])("PB-26-944: UPDATE_ENTRY rejects an invalid supplied primary despite an owned additional URL: %s", async (url) => {359+    const entry = await addLegitEntry();360+    await vault.updateEntry(entry.id, { additionalUrls: [LEGIT] });361+    const before = structuredClone(vault.getEntries());362+    const res = await messages.handleMessage({363+      type: "UPDATE_ENTRY", payload: { id: entry.id, patch: { url } },364+    }, pageSender(LEGIT));365+    expect(res.ok).toBe(false);366+    expect(vault.getEntries()).toEqual(before);367+  });368+369+  it("PB-26-944: UPDATE_ENTRY rejects invalid additional URLs without dropping trusted mappings", async () => {370+    const entry = await addLegitEntry();371+    await vault.updateEntry(entry.id, { additionalUrls: [FOREIGN] });372+    const before = structuredClone(vault.getEntries());373+    const sparseUrls = Object.assign(new Array<unknown>(3), { 0: LEGIT, 2: LEGIT });374+    for (const additionalUrls of [[LEGIT, "ftp://example.com/path"], [LEGIT, ""], [LEGIT, "example.com"], sparseUrls]) {375+      const res = await messages.handleMessage({ type: "UPDATE_ENTRY", payload: { id: entry.id, patch: { additionalUrls } } }, pageSender(LEGIT));376+      expect(res.ok).toBe(false);377+      expect(vault.getEntries()).toEqual(before);378+    }379+  });380+381+  it.each([382+    { url: "http://localhost", additionalUrls: [LEGIT] },383+    { url: LEGIT, additionalUrls: ["http://localhost"] },384+  ])("PB-26-944: ADD_ENTRY rejects every URL without a project domain: %j", async (urls) => {385+    const res = await messages.handleMessage({ type: "ADD_ENTRY", payload: { title: "Unbound URL", ...urls } }, pageSender(LEGIT));386+    expect(res).toMatchObject({ ok: false, error: "origin_binding_required" });387+    expect(vault.getEntries()).toHaveLength(0);388+  });389+390+  it.each([391+    { url: "http://localhost" },392+    { additionalUrls: ["http://localhost", LEGIT] },393+  ])("PB-26-944: UPDATE_ENTRY rejects supplied URLs without a project domain: %j", async (patch) => {394+    const entry = await addLegitEntry();395+    await vault.updateEntry(entry.id, { additionalUrls: [LEGIT] });396+    const before = structuredClone(vault.getEntries());397+    const res = await messages.handleMessage({ type: "UPDATE_ENTRY", payload: { id: entry.id, patch } }, pageSender(LEGIT));398+    expect(res).toMatchObject({ ok: false, error: "origin_binding_required" });399+    expect(vault.getEntries()).toEqual(before);400+  });401+402+  it("PB-26-944: non-URL edits preserve untouched legacy mappings without a project domain", async () => {403+    const entry = await addLegitEntry();404+    await vault.updateEntry(entry.id, { additionalUrls: ["http://localhost"] });405+    const res = await messages.handleMessage({ type: "UPDATE_ENTRY", payload: { id: entry.id, patch: { title: "Legacy mappings" } } }, pageSender(LEGIT));406+    expect(res.ok).toBe(true);407+    expect(vault.getEntryById(entry.id)?.additionalUrls).toEqual(["http://localhost"]);408+  });409+410+  it("PB-26-944: content creation canonicalizes valid URL spelling before binding and storage", async () => {411+    const res = await messages.handleMessage({ type: "ADD_ENTRY", payload: {412+      title: "Canonical URL", url: " HTTPS://EXAMPLE.COM/login ", additionalUrls: ["HTTP://LOGIN.EXAMPLE.COM/path"],413+    } }, pageSender(LEGIT));414+    expect(res.ok).toBe(true);415+    expect(vault.getEntries()[0]).toMatchObject({ url: LEGIT, additionalUrls: ["http://login.example.com/path"] });416+  });417+418+  it("PB-26-944: origin-only content saves retain legacy duplicate detection", async () => {419+    await addLegitEntry();420+    const saved = await messages.handleMessage({ type: "ADD_ENTRY", payload: {421+      title: "Example", username: "victim", password: "hunter2", url: "HTTPS://EXAMPLE.COM",422+    } }, pageSender(LEGIT));423+    expect(saved.ok).toBe(true);424+    expect(vault.getEntries()[1]?.url).toBe("https://example.com");425+    expect(await messages.handleMessage({ type: "COUNT_DUPLICATES" }, extensionSender))426+      .toMatchObject({ ok: true, data: 1 });427+  });428+429+  it.each(["example.com", ""])("PB-26-944: edits preserve an untouched legacy primary URL: %j", async (url) => {430+    const entry = await vault.addEntry({ type: "login", title: "Legacy", url, additionalUrls: [LEGIT], password: "old-password" });431+    const updated = await messages.handleMessage({ type: "UPDATE_ENTRY", payload: {432+      id: entry.id, patch: { password: "new-password" },433+    } }, pageSender(LEGIT));434+    expect(updated.ok).toBe(true);435+    expect(vault.getEntryById(entry.id)).toMatchObject({ url, password: "new-password", additionalUrls: [LEGIT] });436+  });437+438+  it.each([439+    ["https://example.com/", "https://example.com/"],440+    ["HTTPS://synthetic:[email protected]", "https://synthetic:[email protected]"],441+    ["https://example.com?", "https://example.com/?"],442+    ["https://example.com#", "https://example.com/#"],443+  ])("PB-26-944: URL normalization preserves supplied components: %s", async (url, expected) => {444+    const saved = await messages.handleMessage({ type: "ADD_ENTRY", payload: { title: "URL components", url } }, pageSender(LEGIT));445+    expect(saved.ok).toBe(true);446+    expect(vault.getEntries()[0]?.url).toBe(expected);447+  });448+449+  it("PB-26-944: content updates canonicalize supplied URLs but preserve untouched mappings", async () => {450+    const entry = await addLegitEntry();451+    await vault.updateEntry(entry.id, { additionalUrls: [FOREIGN] });452+    const res = await messages.handleMessage({ type: "UPDATE_ENTRY", payload: { id: entry.id, patch: { url: " HTTPS://EXAMPLE.COM/login " } } }, pageSender(LEGIT));453+    expect(res.ok).toBe(true);454+    expect(vault.getEntryById(entry.id)).toMatchObject({ url: LEGIT, additionalUrls: [FOREIGN] });455+  });456+457+  it("PB-26-944: popup URL writes remain unchanged by the content-only schema", async () => {458+    const res = await messages.handleMessage({ type: "ADD_ENTRY", payload: { title: "Local service", url: "http://localhost" } }, extensionSender);459+    expect(res.ok).toBe(true);460+    expect(vault.getEntries()[0]?.url).toBe("http://localhost");461+  });462+463+  it.each(["note", "passkey", "card"] as const)("PB-26-944: content cannot create or edit a %s entry", async (type) => {464+    const res = await messages.handleMessage({ type: "ADD_ENTRY", payload: { type, title: "Not a login", url: LEGIT } }, pageSender(LEGIT));465+    expect(res).toMatchObject({ ok: false, error: "invalid_payload" });466+    expect(vault.getEntries()).toHaveLength(0);467+    const entry = await vault.addEntry({ type, title: "Privileged entry", url: LEGIT,468+      ...(type === "card" ? { cardholderName: "Synthetic User", cardNumber: "4111111111111111" } : {}) });469+    const before = structuredClone(vault.getEntries());470+    const update = await messages.handleMessage({ type: "UPDATE_ENTRY", payload: { id: entry.id, patch: { title: "Page edit" } } }, pageSender(LEGIT));471+    expect(update).toMatchObject({ ok: false, error: "login_entries_only" });472+    expect(vault.getEntries()).toEqual(before);473+  });474+475+  it("PB-26-944: UPDATE_ENTRY cannot change even a login entry's type", async () => {476+    const entry = await addLegitEntry();477+    const before = structuredClone(vault.getEntries());478+    const res = await messages.handleMessage({ type: "UPDATE_ENTRY", payload: { id: entry.id, patch: { type: "login" } } }, pageSender(LEGIT));479+    expect(res).toMatchObject({ ok: false, error: "invalid_payload" });480+    expect(vault.getEntries()).toEqual(before);481+  });482+483+  it("PB-26-944: valid content saves default to login and preserve optional email clearing", async () => {484+    const res = await messages.handleMessage({485+      type: "ADD_ENTRY", payload: { title: "Page draft", url: LEGIT, additionalUrls: ["http://login.example.com/path"], username: "alice", email: undefined, password: "new-password" },486+    }, pageSender(LEGIT));487+    expect(res.ok).toBe(true);488+    const entry = vault.getEntries()[0]!;489+    expect(entry.type).toBe("login");490+    await vault.updateEntry(entry.id, { email: "[email protected]" });491+    const update = await messages.handleMessage({ type: "UPDATE_ENTRY", payload: { id: entry.id, patch: { email: undefined, username: "updated", password: "updated-password" } } }, pageSender(LEGIT));492+    expect(update.ok).toBe(true);493+    expect(vault.getEntryById(entry.id)).toMatchObject({ username: "updated", password: "updated-password" });494+    expect(vault.getEntryById(entry.id)?.email).toBeUndefined();495+  });496+497+  it("PB-26-944: title edits retain trusted foreign mappings and may remove them", async () => {498+    const entry = await addLegitEntry();499+    await vault.updateEntry(entry.id, { additionalUrls: [FOREIGN] });500+    const rename = await messages.handleMessage({ type: "UPDATE_ENTRY", payload: { id: entry.id, patch: { title: "Renamed" } } }, pageSender(LEGIT));501+    expect(rename.ok).toBe(true);502+    expect(vault.getEntryById(entry.id)?.additionalUrls).toEqual([FOREIGN]);503+    const shrink = await messages.handleMessage({ type: "UPDATE_ENTRY", payload: { id: entry.id, patch: { additionalUrls: [] } } }, pageSender(LEGIT));504+    expect(shrink.ok).toBe(true);505+    expect(vault.getEntryById(entry.id)?.additionalUrls ?? []).toEqual([]);506+  });507+508+  it("PB-26-944: legacy entries with an omitted type remain login-editable", async () => {509+    const entry = await addLegitEntry();510+    delete entry.type;511+    expect(vault.getEntryById(entry.id)?.type).toBeUndefined();512+    const res = await messages.handleMessage({ type: "UPDATE_ENTRY", payload: { id: entry.id, patch: { title: "Legacy login" } } }, pageSender(LEGIT));513+    expect(res.ok).toBe(true);514+    expect(vault.getEntryById(entry.id)?.title).toBe("Legacy login");515+  });516+517+  it("PB-26-944: popup writes retain protected fields and URL-less entries", async () => {518+    const res = await messages.handleMessage({ type: "ADD_ENTRY", payload: { type: "note", title: "Private note", notes: "privileged notes", totp: "JBSWY3DPEHPK3PXP" } }, extensionSender);519+    expect(res.ok).toBe(true);520+    const entry = vault.getEntries()[0]!;521+    const update = await messages.handleMessage({ type: "UPDATE_ENTRY", payload: { id: entry.id, patch: { notes: "updated notes" } } }, extensionSender);522+    expect(update.ok).toBe(true);523+    expect(vault.getEntryById(entry.id)?.notes).toBe("updated notes");524+  });311525 });

view file

src/background/messages.ts+69 −8
@@ -272,6 +272,60 @@272272   return domains;273273 }274274 275+const CONTENT_LOGIN_TEXT_FIELDS = new Set(["title", "username", "email", "password", "url"]);276+277+function normalizeContentEntryUrl(value: string): string | null {278+  try {279+    const trimmed = value.trim();280+    const url = new URL(trimmed);281+    if ((url.protocol === "https:" || url.protocol === "http:") && extractDomain(url.href)) {282+      // Origin-only saves must keep matching existing duplicate keys.283+      return url.pathname === "/" && !url.search && !url.hash && url.href.endsWith("/") && !trimmed.endsWith("/")284+        ? url.href.slice(0, -1)285+        : url.href;286+    }287+    return null;288+  } catch {289+    return null;290+  }291+}292+293+function parseContentLoginWrite(294+  fields: object,295+  operation: "create" | "update",296+): { ok: true; fields: Record<string, unknown> } | { ok: false; error: "invalid_payload" | "origin_binding_required" } {297+  const normalized: Record<string, unknown> = {};298+  for (const [key, value] of Object.entries(fields)) {299+    if (key === "type") {300+      if (operation !== "create" || value !== "login") return { ok: false, error: "invalid_payload" };301+    } else if (key === "additionalUrls") {302+      if (!Array.isArray(value)) return { ok: false, error: "invalid_payload" };303+      const urls: string[] = [];304+      for (const extra of value) {305+        if (typeof extra !== "string") return { ok: false, error: "invalid_payload" };306+        const url = normalizeContentEntryUrl(extra);307+        if (!url) return { ok: false, error: "origin_binding_required" };308+        urls.push(url);309+      }310+      normalized.additionalUrls = urls;311+      continue;312+    } else if (!CONTENT_LOGIN_TEXT_FIELDS.has(key) ||313+      (typeof value !== "string" && !(key === "email" && value === undefined))) {314+      return { ok: false, error: "invalid_payload" };315+    }316+    if (key === "url") {317+      const url = normalizeContentEntryUrl(value as string);318+      if (!url) return { ok: false, error: "origin_binding_required" };319+      normalized.url = url;320+    } else normalized[key] = value;321+  }322+  if (operation === "create") {323+    if (typeof normalized.title !== "string") return { ok: false, error: "invalid_payload" };324+    if (typeof normalized.url !== "string") return { ok: false, error: "origin_binding_required" };325+  }326+  return { ok: true, fields: normalized };327+}328+275329 /**276330  * PB-26-106: the autofill read path re-validates the frame origin against the277331  * entry's domains on every request, so an unbound write path would let a@@ -613,16 +667,16 @@613667       }614668       case "ADD_ENTRY": {615669         if (!vault.isUnlocked()) return { ok: false, error: "vault_locked" };616-        const payload = msg.payload;670+        let payload = msg.payload;617671         if (!payload || typeof payload !== "object" || Array.isArray(payload)) {618672           return { ok: false, error: "invalid_payload" };619673         }620-        // PB-26-106: a page may only create an entry bound to itself. Entries621-        // carrying no url have no domain surface to bind, so they are exempt.622674         if (isPageSender(sender)) {623-          const draft = payload as { url?: unknown; additionalUrls?: unknown };624-          const domains = entryDomains(draft.url, draft.additionalUrls);625-          if (domains.size > 0 && !senderMayBindEntryDomains(sender, domains)) {675+          const parsed = parseContentLoginWrite(payload, "create");676+          if (!parsed.ok) return parsed;677+          payload = parsed.fields;678+          const domains = entryDomains(parsed.fields.url, parsed.fields.additionalUrls);679+          if (domains.size === 0 || !senderMayBindEntryDomains(sender, domains)) {626680             return { ok: false, error: "origin_binding_required" };627681           }628682         }@@ -697,12 +751,19 @@697751         if (!payload || typeof payload !== "object" || Array.isArray(payload)) {698752           return { ok: false, error: "invalid_payload" };699753         }700-        const { id, patch } = payload;701-        if (typeof id !== "string" || !id || !patch || typeof patch !== "object" || Array.isArray(patch)) {754+        const { id, patch: inputPatch } = payload;755+        if (typeof id !== "string" || !id || !inputPatch || typeof inputPatch !== "object" || Array.isArray(inputPatch)) {702756           return { ok: false, error: "invalid_payload" };703757         }758+        let patch: object = inputPatch;704759         const existingEntry = vault.getEntryById(id);705760         if (!existingEntry) return { ok: false, error: "entry_not_found" };761+        if (isPageSender(sender)) {762+          if ((existingEntry.type ?? "login") !== "login") return { ok: false, error: "login_entries_only" };763+          const parsed = parseContentLoginWrite(patch, "update");764+          if (!parsed.ok) return parsed;765+          patch = parsed.fields;766+        }706767         if (patchChangesEntryOrigin(patch) || isPageSender(sender)) {707768           const before = entryDomains(existingEntry.url, existingEntry.additionalUrls);708769           const after = patchedUrlShape(patch, existingEntry);

view file

src/content/content.selector-ui.test.ts+31 −1
@@ -237,21 +237,51 @@237237       });238238       expect(sentMessages.some((message) => message.type === "OPEN_POPUP")).toBe(false);239239       expect(sentMessages.some((message) => message.type === "GET_ENTRY_FOR_EDIT")).toBe(false);240+      expect(host?.shadowRoot?.querySelector(".create-form-wrap textarea")).toBeNull();240241 241242       const title = host?.shadowRoot?.querySelector<HTMLInputElement>('.create-form-wrap input[type="text"]');242243       if (title) title.value = "Acme Updated";244+      const url = host?.shadowRoot?.querySelectorAll<HTMLInputElement>('.create-form-wrap input[type="text"]')[1];245+      if (url) url.value = "https://example.com/updated";243246       host?.shadowRoot?.querySelector<HTMLButtonElement>(".create-form-wrap .save-btn")?.click();244247       await vi.waitFor(() => {245248         expect(sentMessages.find((message) => message.type === "UPDATE_ENTRY")).toMatchObject({246249           payload: {247250             id: "e1",248-            patch: { title: "Acme Updated", password: "current-password" },251+            patch: { title: "Acme Updated", url: "https://example.com/updated", password: "current-password" },249252           },250253         });251254       });252255       const patch = sentMessages.find((message) => message.type === "UPDATE_ENTRY")?.payload?.patch;253256       expect(patch).not.toHaveProperty("totp");254257       expect(patch).not.toHaveProperty("passwordHistory");258+      expect(patch).not.toHaveProperty("notes");259+      dismiss();260+    } finally {261+      attachSpy.mockRestore();262+    }263+  });264+265+  it.each(["example.com", ""])("PB-26-944: inline edits omit an unchanged legacy primary URL: %j", async (url) => {266+    const originalAttachShadow = Element.prototype.attachShadow;267+    const attachSpy = vi.spyOn(Element.prototype, "attachShadow").mockImplementation(function (this: Element) {268+      return originalAttachShadow.call(this, { mode: "open" });269+    });270+    const anchor = makeInput({ type: "password" });271+    setMessageResponder((message) => message.type === "GET_ENTRY_FOR_FILL"272+      ? { ok: true, data: { title: "Legacy", username: "alice", password: "old-password", url } }273+      : { ok: true });274+    try {275+      const dismiss = showAutofillSelector(anchor, [ENTRIES[0]!], vi.fn(), { domain: "example.com" });276+      const host = selectorHost();277+      host?.shadowRoot?.querySelector<HTMLButtonElement>(".sp-action-edit")?.click();278+      await vi.waitFor(() => expect(host?.shadowRoot?.querySelector<HTMLInputElement>('.create-form-wrap input[type="password"]')?.value).toBe("old-password"));279+      const password = host?.shadowRoot?.querySelector<HTMLInputElement>('.create-form-wrap input[type="password"]');280+      if (password) password.value = "new-password";281+      host?.shadowRoot?.querySelector<HTMLButtonElement>(".create-form-wrap .save-btn")?.click();282+      await vi.waitFor(() => expect(sentMessages.find((message) => message.type === "UPDATE_ENTRY"))283+        .toMatchObject({ payload: { patch: { password: "new-password" } } }));284+      expect(sentMessages.find((message) => message.type === "UPDATE_ENTRY")?.payload?.patch).not.toHaveProperty("url");255285       dismiss();256286     } finally {257287       attachSpy.mockRestore();

view file

src/content/inject.ts+5 −17
@@ -3021,7 +3021,6 @@30213021         email?: string;30223022         password?: string;30233023         url?: string;3024-        notes?: string;30253024       };30263025     } | null;30273026     if (!response?.ok || !response.data) {@@ -3048,7 +3047,8 @@30483047 30493048     const entry = response.data;30503049     const titleInput = field("title", entry.title ?? summary.title);3051-    const urlInput = field("url", entry.url ?? summary.url ?? "");3050+    const originalUrl = (entry.url ?? summary.url ?? "").trim();3051+    const urlInput = field("url", originalUrl);30523052     const usernameInput = field("username", entry.username ?? summary.username ?? "");30533053     const emailInput = field("email", entry.email ?? summary.email ?? "");30543054     const passwordInput = field("password", entry.password ?? "", "password");@@ -3069,18 +3069,6 @@30693069     });30703070     body.append(generatorToggle, generator.root);30713071 3072-    const notesGroup = document.createElement("div");3073-    notesGroup.className = "f-group";3074-    const notesLabel = document.createElement("div");3075-    notesLabel.className = "f-label";3076-    notesLabel.textContent = "notes";3077-    const notesInput = document.createElement("textarea");3078-    notesInput.className = "f-input";3079-    notesInput.rows = 3;3080-    notesInput.value = entry.notes ?? "";3081-    notesGroup.append(notesLabel, notesInput);3082-    body.appendChild(notesGroup);3083-30843072     const actions = document.createElement("div");30853073     actions.className = "f-row";30863074     const save = document.createElement("button");@@ -3099,13 +3087,13 @@30993087     save.addEventListener("click", async () => {31003088       save.disabled = true;31013089       save.textContent = "Saving…";3090+      const url = urlInput.value.trim();31023091       const patch = {31033092         title: titleInput.value.trim(),3104-        url: urlInput.value.trim(),3093+        ...(url !== originalUrl ? { url } : {}),31053094         username: usernameInput.value.trim(),31063095         email: emailInput.value.trim() || undefined,31073096         password: passwordInput.value,3108-        notes: notesInput.value,31093097       };31103098       const update = await chrome.runtime.sendMessage({31113099         type: "UPDATE_ENTRY",@@ -3124,7 +3112,7 @@31243112       renderSilverPlatter({31253113         ...summary,31263114         title: patch.title,3127-        url: patch.url,3115+        url,31283116         username: patch.username,31293117         email: patch.email,31303118       });

view file