GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(browser-extensions): add verified CRX3, safe ZIP, integrity, and permissions review crate by Hona · Pull Request #280 · anomalyco/opencode-rune

Conversation

@Hona

@Hona Hona commented Nov 20, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Summary

Adds the pure-Rust (#![forbid(unsafe_code)]) workspace crate crates/browser-extensions implementing Chrome Web Store / Edge Add-ons CRX3 signature verification, bounded safe ZIP unpacking, parallel hardware-accelerated SHA-256 tree integrity verification, manifest & __MSG_*__ parsing, raster icon magic-byte & dimension verification, Chromium 156 compatibility classification, truthful permissions review & explicit InstallState machine, and read-only Chromium profile extension discovery (WS-9 PR 2 of 5; independent security review before merge).

Zero new third-party crates added to workspace Cargo.lock (reuses already-locked ring 0.17, sha2 0.10, flate2 1, crc32fast 1, icu_normalizer 2.4 [no default features], libc 0.2 on Unix, base64, ureq 3.5 with platform-verifier, serde, serde_json, browser-policy).

Hardening Pass — Round 2 Delta (b8ba6a24, Addressing Every review-rd280.md Delta Finding & Note)

  1. Zero silent truncation in manifest/review parsing (manifest.rs): Removed sanitized_string_array .take(256) and review_hosts break; checked_string_array, content_scripts[].matches, externally_connectable, and web_accessible_resources (including extension_ids) now fail closed (parse_manifest -> None) if any list exceeds MAX_LIST_ITEMS (256) or contains any non-string, empty, overlong (> 256 B), or control/bidi element. review_hosts inspects all three sources completely. Padding 256 harmless entries ahead of debugger / cookies / <all_urls> now refuses the package outright.
  2. Real Windows no-follow & reparse-point rejection (integrity.rs, manager.rs, zip.rs, icon.rs, sources.rs):
    • open_regular_no_follow and pin_manifest_key open with FILE_FLAG_OPEN_REPARSE_POINT (0x0020_0000) on Windows and verify !is_reparse_or_symlink(&fmeta) (FILE_ATTRIBUTE_REPARSE_POINT 0x0400) on the opened handle itself (and pin_manifest_key truncates via set_len(0) only after handle verification).
    • Unix ensure_dir_no_symlink_user_only creates new directories atomically with DirBuilder::mode(0o700) (no umask window) and tightens existing directories via fchmod on an O_NOFOLLOW | O_DIRECTORY descriptor (no symlink-following chmod).
    • Added ExtensionManager::in_user_data(user_data_dir) (production constructor for PRs 3–5): requires a real non-symlink/non-reparse user_data_dir, refuses shared/world-writable Windows locations (\Users\Public, \ProgramData, \Windows\Temp), and anchors <userData>/browser-extensions under the per-user %LOCALAPPDATA% owner+SYSTEM+Admins DACL on Windows and 0o700 on Unix.
  3. ICO embedded payload dimension verification (icon.rs): inspect_raster_icon now bounds-checks every ICONDIRENTRY payload slice and inspects the embedded PNG IHDR or BMP BITMAPINFOHEADER (1..=1024, even 2× DIB height) instead of trusting the 1-byte nominal directory size — blocking < 64 KiB ICO-wrapped 65535×65535 PNG and BMP pixel bombs.
  4. Port-preserving covers_pattern (manifest.rs): ParsedPattern preserves port: Option<String> and requires port_covers (None/Some("*") covers any port; explicit :port covers only that exact port), so updates widening https://example.com:8443/* → https://example.com/* or https://*:8443/* → https://*/* are surfaced in added.hosts.
  5. Hardened InstallMachine, move-only StagedInstall, and confined approve_staged (review.rs, manager.rs):
    • InstallMachine tracks last_generation (ignoring generation == 0 or non-monotonic reuse) and created_at_ms + now_ms.checked_add(REVIEW_TTL_MS) (failing closed on backward wall-clock steps now_ms < created_at_ms, u64::MAX overflow, and exact expiry now_ms >= expires_at_ms).
    • StagedInstall no longer derives Clone; InstallEffect::VerifyAndSwap carries { token, staged_dir, record, review }.
    • approve_staged validates staged.record.directory == self.root.join(&staged.record.id) and verifies staged.staged_dir is a direct .staging-* child of non-symlink self.root (remove_staging_dir) before any delete or rename.
  6. Additional reader notes settled:
    • Collision-only Windows 8.3 detection (zip.rs): has_windows_83_collision refuses syntactic PREFIX~N[.EXT] aliases only when another non-8.3 filename in the same directory generates a colliding 8.3 short name (e.g. background.js + BACKGR~1.JS, manifest.json + MANIFE~1.JSO), allowing legitimate Webpack chunks like app~1.js; CREATE_NEW remains the OS backstop.
    • Forced-ZIP64 small archives (zip.rs): valid_zip64_trailer accepts a clean 76-byte ZIP64 EOCD + Locator between cd_end and eocd when all ZIP64 EOCD fields match the 32-bit EOCD exactly (still rejecting unreferenced gaps, multi-disk, >4 GiB sentinels, and mismatched ZIP64 differentials).
    • Single classification for proxy & management (manifest.rs): Removed both from SUPPORTED_PERMS and mapped proxy -> Network (management -> Other) so all 5 disallowed permissions consistently emit Unsupported(DisallowedPermission) with non-empty missing.
    • Bounded seen_dirs (zip.rs): Added MAX_SEEN_DIRS = 65_536.
    • Restored macOS browser definitions (sources.rs): Restored dia and comet.

Hardening Pass — Round 1 (6362c64b, review-rd280.md Items 1–7)

  1. Quadratic ZIP memory OOM eliminated (zip.rs): entry_path enforces hard caps (MAX_PATH_BYTES = 1024, MAX_SEGMENT_BYTES = 255, MAX_DEPTH = 64) before allocating or storing anything; seen_dirs inserts only unseen prefixes (capped at MAX_SEEN_DIRS = 65_536).
  2. Unicode case/NFD & Windows 8.3 collisions + atomic creation + device/control checks (zip.rs, browser-policy):
    • Full Unicode case-folding + ICU4X NFD normalization (DecomposingNormalizer::new_nfd) catches É.js/é.js and NFC \u{00E9}.js/NFD e\u{0301}.js collisions cross-platform before writing to disk.
    • Collision-only Windows 8.3 detection + COM0/LPT0 (alongside COM1..9, LPT1..9, COM¹..³, LPT¹..³), DEL (0x7F), and C1 controls (U+0080..=U+009F).
    • Rejects Unix (3) & macOS (19) symlinks/special modes and Windows (0|10|11|14) reparse points (0x0400).
    • Unpacks files strictly via atomic OpenOptions::new().write(true).create_new(true) (+ O_NOFOLLOW on Unix) with mid-archive partial cleanup on failure.
  3. Zero staging TOCTOU (manager.rs, integrity.rs):
    • stage_common runs extension_tree_digest_and_manifest(&staging) first, verifies derive_id_from_manifest_bytes(&manifest_bytes) == Some(record.id), parses Manifest from those exact hashed bytes, and re-verifies the tree digest after reading _locales / icons.
    • copy_dir_safe replaces std::fs::copy with opened non-symlink/non-reparse handles (open_regular_no_follow: O_NOFOLLOW + (dev, ino) on Unix, FILE_FLAG_OPEN_REPARSE_POINT + FILE_ATTRIBUTE_REPARSE_POINT on Windows) + bounded Read::take(cap + 1) + atomic create_new, and refuses copying an ancestor of dst into dst.
    • Parallel SHA-256 hashing fails closed if any worker thread panics (partials.len() != workers).
  4. Install state machine & single-use token hardening (review.rs, manager.rs): InstallMachine, monotonic generation, created_at_ms + checked_add(REVIEW_TTL_MS) 10-minute TTL, non-preemptible Swapping, constant-time equality, move-only StagedInstall, and confined approve_staged.
  5. Truthful permissions review, UI sanitization, icon sniffing, and disallowed native permissions (manifest.rs, icon.rs, review.rs, sources.rs):
    • Row-by-row comparison vs upstream review.ts & compatibility.ts (where ours says more):
      • <all_urls>, *://*/*, https://*/* → AllSites (parity)
      • https://*:*/*, *://*:443/* (port wildcards) → AllSites (upstream's regex misses port wildcards and collapses them to SomeSites with sites: [])
      • https://example.com:8443/* → https://example.com/* → surfaced in added.hosts via port-aware covers_pattern
      • *.co.uk, *.github.io, *.s3.amazonaws.com → *.co.uk / *.github.io / *.s3.amazonaws.com preserved as broad wildcards (expanded multi-label public & private suffix table; ASCII-only <= 64 chars)
      • cookies / tabs|webNavigation|history / clipboardRead → Cookies / Activity / Clipboard (parity)
      • proxy → Proxy access badge + refused at load/approval (DisallowedPermission) (upstream allows with no access badge)
      • declarativeNetRequest* → BlockRequests access badge (upstream emits no access badge even without host_permissions)
      • management → ManageExtensions access badge + refused at load/approval (DisallowedPermission) (upstream allows with no access badge)
      • debugger, nativeMessaging, downloads (required permissions only; optional_permissions such as Bitwarden's nativeMessaging stay allowed because Chromium doesn't grant them and chrome.permissions.request() refuses runtime grants) → refused at load/approval (DisallowedPermission) (upstream allows nativeMessaging/downloads and allows "Add anyway" on debugger)
      • externally_connectable & web_accessible_resources → parsed, surfaced via ExternalConnect / WebAccessible badges, and tracked in ReviewedGrants for update deltas (unparsed upstream)
    • Strict Chrome dotted-integer version parsing (1–4 ASCII digit segments, rejecting bidi/newline/garbage); fail-closed manifest list validation (<= 256 items, <= 256 chars — eliminating glob_match CPU DoS without truncating).
    • icon.rs reads icons via bounded Read::take(64 KiB + 1), verifies magic bytes match file extension (PNG/JPEG/GIF/WebP/ICO; .svg refused), and enforces pixel dimensions 1..=1024 × 1..=1024 including embedded ICO PNG/BMP payloads.
  6. Differential ZIP header checks (zip.rs): Enforces cd_end == eocd or verified matching single-disk ZIP64 trailer, disk_number_start == 0, agreement on local-vs-central method, flags (bits 0, 3, 6, 11), filename, and (when bit 3 unset) crc32/compressed_size/uncompressed_size; validates directory entries have zero payload (including verifying CWS 2-byte empty Deflate directories inflate to 0 bytes).
  7. Download, downgrade, and rollback hardening (crx.rs, manager.rs, sources.rs): is_valid_ext_id before URL construction, shared 90 s total deadline across all redirect hops, .https_only(true), RootCerts::PlatformVerifier, ureq::http::Uri cross-check, downgrade fallback to installed manifest.json, is_real_dir + canonicalize(self.root) confinement on rollback_swap/finalize_swap/remove_staging_dir/remove_managed_dir, and symlink-free sources.rs (including macOS dia/comet).

Verification & 41/41 Hostile Vector Proof (proof/ws9/pr2-verifier-proof.json)

  • scripts/guardrails.ps1: 5/5 passed (0 files > 800 lines in crates/browser-extensions).
  • cargo clippy -p browser-policy -p browser-extensions --all-targets -- -D warnings: 0 warnings.
  • cargo check -p browser-extensions --target wasm32-unknown-unknown: green.
  • cargo check --workspace & scripts/web.ps1 -Check: green.
  • Live Chrome Web Store download & verify: Dark Reader (eimadpbcbfnmbkopoojfekhnkhdbieeh, 858,730 B, v4.9.135, SHA-256 ea87538ae3d171253f1f74bd2cdafad63da409e6b006922b8bb8e2203ffc651f) downloaded live over HTTPS (PlatformVerifier) and verified; real CWS uBlock Origin Lite & Bitwarden ZIPs validated cleanly (Bitwarden's optional nativeMessaging stays allowed while required disallowed permissions are blocked).
  • 41/41 hostile & regression vectors passed (all true):
    • crxZipFlipRejected, crxHeaderFlipRejected, crxWrongIdRejected
    • redirectEvilRefused, redirectCredsRefused, redirectEdgeHttpUpgradedToHttps, invalidStoreTargetIdRefused
    • allBadZipPathsAndCom0Lpt0DelC1Refused, zip83CollisionOnlyAllowsWebpackRefusesClash, zipForcedZip64AcceptedAndMismatchedRefused, zipQuadraticNestingOomRefused, zipUnicodeCaseAndNfdCollisionRefused, zipUnixMacosWinSymlinkReparseRefused, zipLocalCentralMethodCrcFlagsGapRefused, zipEncryptedRefused, zipCaseDuplicateRefused, zipHeaderDiffRefused, zipBombRefused, zipBadCrcRefused
    • storeDowngradeRefused, storeDowngradeMissingStoredVersionFallbackRefused
    • stagedTamperBetweenReviewAndApproveRefused, installedTamperRefusedAtStartup, windowsReparsePointAndPublicRootRefused, copyDirSafeSelfNestRefused
    • stateMachineGenRollbackOverflowSwappingTtlHardened, approveStagedOutOfRootNotDeleted, approveStagedWrongTokenRefusedAndCleaned
    • mv2ClassifiedUnsupportedAndBlocked, disallowedRequiredPermsBlockedAndConsistentMissing, manifestPaddingOverLimitRefusedNeverTruncated, updatePortEscalationDetectedInAddedHosts, bitwardenOptionalNativeMessagingStillAllowed
    • reviewTruthfulProxyDnrMgmtExtConnWarAndPortWildcard, reviewMultiLabelWildcardSuffixesPreserved, manifestBidiAndNewlineVersionRejected, globMatchCpuDosBounded, iconMagicAndPixelBombRejected, icoEmbeddedPngAndBmpPixelBombsRejected
    • localFolderPrivateP256KeyAndSites, reviewAddedGrantsDelta

Conditions Carried Forward to PRs 3–5

  • Managed root is constructed via ExtensionManager::in_user_data(user_data_dir) strictly at <userData>/browser-extensions (outside all workspaces, Downloads, and shared Windows folders; inherits %LOCALAPPDATA% owner+SYSTEM+Admins DACL on Windows and enforces 0o700 on Unix).
  • Every install, review, approve, enable, and remove action is strictly user-driven (scope.is_builtin_browser && scope.tool_sid.is_none()), unreachable by agent tools or third-party plugins.
  • Running extensions are unloaded before approve_staged swaps on Windows; StoredExtension is persisted via opencode-storage only after engine load succeeds (with rollback_swap on load failure).
  • Review UI displays every risk category (Proxy, BlockRequests, ManageExtensions, ExternalConnect, WebAccessible, host/site access, added deltas) and hard-blocks approval on ManifestV2 and DisallowedPermission.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Hona
feat(browser-extensions): add verified CRX3, safe ZIP, integrity, and…
ed56a4e
… permissions review crate
@Hona Hona mentioned this pull request Nov 20, 2026
feat(browser-pane): wire MV3 extension lifecycle, DNR filter gate, popup surface, and restart-restore #283
Merged
@github-actions

github-actions Bot commented Nov 20, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

PR test build retired — merged into dev. Install or auto-update OpenCode (Rune) from https://anoma.ly/release/opencode/desktop-rune/dev/macos-arm64-dmg.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Hona added 2 commits November 20, 2026 22:29
@Hona
fix(browser-extensions): harden ZIP, staging TOCTOU, review state mac…
6362c64
…hine, icons, and permissions per security review
@Hona
fix(browser-extensions): fail closed on manifest caps, Windows repars…
b8ba6a2
…e no-follow, ICO payloads, port deltas, and InstallMachine guards
@Hona
Hona merged commit b019dad into dev Nov 20, 2026
7 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@Hona
Hona deleted the ws9/pr2-browser-extensions-crate branch November 20, 2026 14:28
Hona added a commit that referenced this pull request Nov 20, 2026
@Hona
docs(sync): fold #278-#293, add browser Reviewed column, and add UP-1…
e9b29cd
…18..UP-122 (#295)

- Fold verified fleet PRs #278, #285, #287, #288, #289, #290, #291, and
  #293 (Rune dc8f7f72: #1301, #1302 focus rescue verified Send+Enter -> effort)
  into docs/upstream-sync/ledger.{json,md}
- Close UP-062 packaged-default regression (#278), UP-095-UI / UP-100 /
  UP-106 / UP-109 / UP-117 (#285, #289), and PRE-08 (#287); reassign
  UP-115, UP-116, UP-075 to BROWSER-UI
- Add separate Reviewed column for browser rows tracking retrospective
  security reviews on merged PRs (#245, #268, #272, #277, #288, #275, #287,
  #285, #289) and pre-merge holds (#274, #280, #281, #283, #286, #292, #294,
  and BROWSER-TOOLS PR 3+)
- Audit upstream anomalyco/opencode bfee96a859..2002222d13 (+6 commits:
  1 skipped, 5 added: UP-118..UP-122) and refine radar routing
Hona added a commit that referenced this pull request Nov 20, 2026
@Hona
docs(sync): fold #280, #281, #297, #299, #300 and add UP-123..UP-134 (#…
b62e698
…304)

- Fold verified merged PRs #280 (WS-9 crates/browser-extensions, confirmed),
  #281 (PREVIEWS oc-preview:// + ContextPool::is_tab_ready, confirmed third
  read + merge check), #297 (inline chat video + reply link menu, not
  reviewed before merge), #299 (WS-1 close_all_connections crash fix), and
  #300 (Rune eff95e80: #1304 roving-group rescue + #1291 monochrome SMIL
  animated icons completing UP-069 / WS-6)
- Update browser Reviewed column and note #287 eager-attach time_updated
  regression on UP-095-TOOLS
- Audit upstream anomalyco/opencode 2002222d13..fe8def6854 (+19 commits:
  7 skipped, 12 added: UP-123..UP-134)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@Hona
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.