Files
bookmarkmagic/docs/09_SECURITY_PRIVACY.md
T
poli0981andClaude Opus 5 9e9107093e fix: close the eight findings the Phase 5 review confirmed
Five lenses filed 20; 8 survived verification.

**release.yml would have failed on the first tag.** The `announce` job called
the ops reusable with no `with:` block, but that reusable resolves
TAG="${INPUT_TAG:-$EVENT_TAG}" where EVENT_TAG is github.event.release.tag_name
-- empty, because this workflow is triggered by `on: push: tags`, not
`on: release`. The job would have exited 1 on "No release tag available" for
every release. Filed independently by three lenses and confirmed against the
reusable's actual source; docs/12 §2.3 had the same omission and is fixed too.
Ironically the comment right above it explains why the workflow deliberately is
not event-driven -- which is exactly what makes tag_override mandatory.

**Nothing checked the BUILT manifest.** The unit test reads wxt.config.ts,
which proves what we ask for, not what WXT emits. Those differ: a dev build of
this same config carries ["bookmarks","storage","tabs","scripting"] and
host_permissions ["http://localhost/*"]. Production is clean, but that is
WXT's behaviour, not ours. scripts/check-manifest.mjs now gates the artifact
and runs in both CI and release; verified by editing a built manifest. The
README sentence claiming a test asserted the built manifest was false and is
corrected -- the same overclaim I had already made once verbally.

**The contrast test I added last commit could not see its own bypass.**
TabBar's `.locked { opacity: 0.65 }` composites --fg-muted against the page and
drops the label to 2.83:1. The test reads token values, so alpha applied on top
is invisible to it. Opacity removed; the padlock and title already carried the
signal. TEXT_PAIRS also widened to check the status colours on --bg, not only
--bg-raised.

**docs/09 T3 was signed off with half its mitigation unbuilt.** The row has
always specified a ⚠ badge for dangerous schemes; only the blocking existed. A
`javascript:` bookmark titled "Your bank" rendered identically to a safe one
and its Open button silently did nothing. isBlockedUrl now drives a badge, and
a refused open raises a toast.

Also: the five row action buttons had glyphs as their accessible names (content
beats title in accname), so voice control could not address them; the manifest
test's literal-harvesting regex would have passed a spread or identifier;
resolveNewFolderParent returned a focused unmodifiable folder's id, which every
create rejects; and clipboard.ts was the only new module with no test.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 14:44:08 +07:00

7.3 KiB

09 — Security & Privacy

1. Privacy guarantees (product-level, non-negotiable)

  1. Zero data collection. No analytics, no telemetry, no crash reporting, no update pings. There is no server.
  2. Zero network activity at runtime. Enforced by the canonical grep gate defined in 08_MV3 §3 — that block is the single source of truth for the pattern; do not restate it here.
  3. Everything on-device. Bookmarks are read/written via chrome.bookmarks locally; files are parsed in-page and downloaded via Blob URLs. chrome. storage.local holds only settings + legal flag (no storage.sync — even settings stay off the vendor cloud, consistent with the product promise).
  4. Open source (GPL-3.0) — the privacy claims are verifiable.

2. Threat model

# Threat Vector Mitigation
T1 Malicious import file — markup injection Crafted <script>/onerror payloads in a .html bookmark file DOMParser('text/html') produces an inert document (scripts never execute). We read textContent/getAttribute only. Rendering uses Svelte text interpolation — {@html} is banned repo-wide.
T2 Malicious file — resource exhaustion (huge/deep/zip-bomb-style) 500 MB file, 1M nodes, 10k-deep nesting Pre-parse size cap 25 MB; node cap 100 000; depth cap 200 — typed errors, parse aborts early. Lazy tree rendering (§05 §9) bounds DOM size.
T3 Dangerous URLs in imported bookmarks (javascript:, data:) Clicking them in #edit Never rendered as <a href>; "Open" uses tabs.create, which refuses javascript:. UI marks non-http(s)/ftp/file/about/chrome schemes with a ⚠ badge; they are display-only. Imported URLs are stored verbatim (user's data, not ours to censor) — the browser's own bookmark UI applies its own rules.
T4 Data loss from destructive import User picks "Replace all" casually Non-skippable auto safety-backup (BM JSON download) before deletion; danger-styled confirm with exact counts; default mode is non-destructive new-folder.
T5 Supply-chain compromise Malicious transitive dep Zero runtime deps; dev deps pinned via lockfile; Dependabot + npm audit in CI; Biome installed exact-pinned.
T6 Store-listing impersonation / trademark issues — Unique name + linked GitHub; report via CWS if cloned.
T7 XSS via filenames/titles echoed into UI (result cards, toasts) Weird characters in file name Same as T1 — text interpolation only; filenames additionally sanitized for the download name (`[\/:*?"<>
T8 Clipboard abuse "Copy URL" action Uses navigator.clipboard.writeText on explicit user click only; never reads the clipboard.

Pass performed 2026-07-26 (Phase 5)

# Now enforced by
T1 tests/unit/core/fixtures.test.ts parses malformed/script-injection.html and asserts the payloads survive as inert text. DOMParser('text/html') never executes scripts, and {@html} is barred by npm run guard.
T2 tests/unit/core/limits.test.ts plus the caps in core/limits.ts. Measured: a 100k-node file parses without exhausting anything (11 §6).
T3 malformed/js-url.html at parse level, tests/unit/browser/open-url.test.ts at the point of use — javascript:, data:, file:, chrome:, vbscript: and case-shouted variants are refused before tabs.create — and the ⚠ badge this row has always specified, which isBlockedUrl now drives in TreeRow. A refused open also raises a toast; it used to do nothing at all, which read as a broken button rather than a deliberate refusal.
T4 tests/unit/import/safety-backup.test.ts.
T5 npm audit --omit=dev reports 0 — every open Dependabot alert is development scope.
T6 Human; nothing in code.
T7 sanitizeFilename (tests/unit/browser/download.test.ts); everything else reaches the DOM through Svelte text interpolation.
T8 browser/clipboard.ts — write-only, click-only, never reads. Implemented in Phase 5; it had been specified in 06 §3.3 and here since the start but never built.

Three gaps this pass closed, all of which had gone unnoticed because nothing mechanical was watching:

  • The permission list had no gate at all. Two now exist, and both are needed. tests/unit/manifest.test.ts asserts ['bookmarks', 'storage'] against wxt.config.ts — what we ask for. scripts/check-manifest.mjs asserts the built artifact, which is not the same thing: a dev build of this identical config emits "permissions": ["bookmarks","storage","tabs","scripting"] and "host_permissions": ["http://localhost/*"], because WXT injects them. Production is clean today, but that is WXT's behaviour, not our enforcement. Both were verified to fail — one by adding 'tabs' to the config, the other by editing the built manifest.
  • "Copy URL" did not exist, so T8 described the mitigation for a feature that was never shipped.
  • T3's ⚠ badge did not exist either. The blocking half was real and tested; the "mark dangerous schemes in the UI" half was not, so a javascript: bookmark titled "Your bank" rendered exactly like a safe one and its Open button silently did nothing.

3. Secure coding rules (enforced)

  • {@html} — forbidden. Enforced by the canonical grep gate (08 §3) and review. Biome has no rule for this: noDangerouslySetInnerHtml is a React rule and does not see Svelte templates.
  • innerHTML, outerHTML, insertAdjacentHTML assignment — forbidden (same gate).
  • All user/file-derived strings cross into the DOM only via Svelte text bindings or textContent.
  • URL constructor for any URL handling; no string-splitting of URLs.
  • No Math.random for anything security-relevant (ids use crypto.randomUUID() where local ids are needed).
  • Typed wrappers only for chrome.* (single audited surface, src/lib/browser/).
  • Error messages shown to users never include raw file content beyond a ≤120-char excerpt of the offending line (avoids log-injection weirdness in screenshots/issues).

4. Permissions posture

bookmarks + storage, nothing else (justifications in 08 §2). Any PR adding a permission must update docs 08/09/13 + the store Privacy tab, and is a minor-version event at minimum.

5. Release integrity

  • Builds are content-reproducible from a clean checkout: npm ci && npm run zip. Verified 2026-07-26 by building the same commit in a fresh clone and in the working tree — every entry in the two zips has an identical name and CRC32. The archives' SHA-256 hashes still differ, because wxt zip records file mtimes and nothing normalizes them (there is no SOURCE_DATE_EPOCH support). Do not claim byte-identical rebuilds.
  • GitHub Releases attach the exact zip uploaded to CWS + SHA256SUMS.txt so users can verify store build ↔ source correspondence. That works on the released artifact itself, which is the same file in both places — it is not a claim that a third party can rebuild the same hash.
  • Tags are signed (GPG) — consistent with the tracker-repo signing practice.

6. Vulnerability reporting

SECURITY.md in repo root (⚠️ create at scaffold): report privately via GitHub Security Advisories; acknowledgment target 72h; fix-or-mitigate target 14 days for High/Critical. No bounty (hobby project) — credit given in release notes.