Repository navigation
feat(browser-extensions): add verified CRX3, safe ZIP, integrity, and permissions review crate - #280
Merged
Merged
Conversation
… permissions review crate
|
PR test build retired — merged into |
…hine, icons, and permissions per security review
…e no-follow, ICO payloads, port deltas, and InstallMachine guards
Hona
added a commit
that referenced
this pull request
Nov 20, 2026
…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
…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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds the pure-Rust (
#![forbid(unsafe_code)]) workspace cratecrates/browser-extensionsimplementing 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 & explicitInstallStatemachine, 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-lockedring 0.17,sha2 0.10,flate2 1,crc32fast 1,icu_normalizer 2.4[no default features],libc 0.2on Unix,base64,ureq 3.5withplatform-verifier,serde,serde_json,browser-policy).Hardening Pass — Round 2 Delta (
b8ba6a24, Addressing Everyreview-rd280.mdDelta Finding & Note)manifest.rs): Removedsanitized_string_array.take(256)andreview_hostsbreak;checked_string_array,content_scripts[].matches,externally_connectable, andweb_accessible_resources(includingextension_ids) now fail closed (parse_manifest -> None) if any list exceedsMAX_LIST_ITEMS(256) or contains any non-string, empty, overlong (> 256B), or control/bidi element.review_hostsinspects all three sources completely. Padding 256 harmless entries ahead ofdebugger/cookies/<all_urls>now refuses the package outright.integrity.rs,manager.rs,zip.rs,icon.rs,sources.rs):open_regular_no_followandpin_manifest_keyopen withFILE_FLAG_OPEN_REPARSE_POINT(0x0020_0000) on Windows and verify!is_reparse_or_symlink(&fmeta)(FILE_ATTRIBUTE_REPARSE_POINT0x0400) on the opened handle itself (andpin_manifest_keytruncates viaset_len(0)only after handle verification).ensure_dir_no_symlink_user_onlycreates new directories atomically withDirBuilder::mode(0o700)(no umask window) and tightens existing directories viafchmodon anO_NOFOLLOW | O_DIRECTORYdescriptor (no symlink-followingchmod).ExtensionManager::in_user_data(user_data_dir)(production constructor for PRs 3–5): requires a real non-symlink/non-reparseuser_data_dir, refuses shared/world-writable Windows locations (\Users\Public,\ProgramData,\Windows\Temp), and anchors<userData>/browser-extensionsunder the per-user%LOCALAPPDATA%owner+SYSTEM+Admins DACL on Windows and0o700on Unix.icon.rs):inspect_raster_iconnow bounds-checks everyICONDIRENTRYpayload slice and inspects the embedded PNGIHDRor BMPBITMAPINFOHEADER(1..=1024, even2×DIB height) instead of trusting the 1-byte nominal directory size — blocking< 64 KiBICO-wrapped65535×65535PNG and BMP pixel bombs.covers_pattern(manifest.rs):ParsedPatternpreservesport: Option<String>and requiresport_covers(None/Some("*")covers any port; explicit:portcovers only that exact port), so updates wideninghttps://example.com:8443/*→https://example.com/*orhttps://*:8443/*→https://*/*are surfaced inadded.hosts.InstallMachine, move-onlyStagedInstall, and confinedapprove_staged(review.rs,manager.rs):InstallMachinetrackslast_generation(ignoringgeneration == 0or non-monotonic reuse) andcreated_at_ms+now_ms.checked_add(REVIEW_TTL_MS)(failing closed on backward wall-clock stepsnow_ms < created_at_ms,u64::MAXoverflow, and exact expirynow_ms >= expires_at_ms).StagedInstallno longer derivesClone;InstallEffect::VerifyAndSwapcarries{ token, staged_dir, record, review }.approve_stagedvalidatesstaged.record.directory == self.root.join(&staged.record.id)and verifiesstaged.staged_diris a direct.staging-*child of non-symlinkself.root(remove_staging_dir) before any delete or rename.zip.rs):has_windows_83_collisionrefuses syntacticPREFIX~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 likeapp~1.js;CREATE_NEWremains the OS backstop.zip.rs):valid_zip64_traileraccepts a clean 76-byte ZIP64 EOCD + Locator betweencd_endandeocdwhen all ZIP64 EOCD fields match the 32-bit EOCD exactly (still rejecting unreferenced gaps, multi-disk,>4 GiBsentinels, and mismatched ZIP64 differentials).proxy&management(manifest.rs): Removed both fromSUPPORTED_PERMSand mappedproxy -> Network(management -> Other) so all 5 disallowed permissions consistently emitUnsupported(DisallowedPermission)with non-emptymissing.seen_dirs(zip.rs): AddedMAX_SEEN_DIRS = 65_536.sources.rs): Restoreddiaandcomet.Hardening Pass — Round 1 (
6362c64b,review-rd280.mdItems 1–7)zip.rs):entry_pathenforces hard caps (MAX_PATH_BYTES = 1024,MAX_SEGMENT_BYTES = 255,MAX_DEPTH = 64) before allocating or storing anything;seen_dirsinserts only unseen prefixes (capped atMAX_SEEN_DIRS = 65_536).zip.rs,browser-policy):DecomposingNormalizer::new_nfd) catchesÉ.js/é.jsand NFC\u{00E9}.js/NFDe\u{0301}.jscollisions cross-platform before writing to disk.COM0/LPT0(alongsideCOM1..9,LPT1..9,COM¹..³,LPT¹..³), DEL (0x7F), and C1 controls (U+0080..=U+009F).3) & macOS (19) symlinks/special modes and Windows (0|10|11|14) reparse points (0x0400).OpenOptions::new().write(true).create_new(true)(+O_NOFOLLOWon Unix) with mid-archive partial cleanup on failure.manager.rs,integrity.rs):stage_commonrunsextension_tree_digest_and_manifest(&staging)first, verifiesderive_id_from_manifest_bytes(&manifest_bytes) == Some(record.id), parsesManifestfrom those exact hashed bytes, and re-verifies the tree digest after reading_locales/ icons.copy_dir_safereplacesstd::fs::copywith opened non-symlink/non-reparse handles (open_regular_no_follow:O_NOFOLLOW+(dev, ino)on Unix,FILE_FLAG_OPEN_REPARSE_POINT+FILE_ATTRIBUTE_REPARSE_POINTon Windows) + boundedRead::take(cap + 1)+ atomiccreate_new, and refuses copying an ancestor ofdstintodst.partials.len() != workers).review.rs,manager.rs):InstallMachine, monotonicgeneration,created_at_ms+checked_add(REVIEW_TTL_MS)10-minute TTL, non-preemptibleSwapping, constant-time equality, move-onlyStagedInstall, and confinedapprove_staged.manifest.rs,icon.rs,review.rs,sources.rs):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 toSomeSiteswithsites: [])https://example.com:8443/*→https://example.com/*→ surfaced inadded.hostsvia port-awarecovers_pattern*.co.uk,*.github.io,*.s3.amazonaws.com→*.co.uk/*.github.io/*.s3.amazonaws.compreserved as broad wildcards (expanded multi-label public & private suffix table; ASCII-only<= 64chars)cookies/tabs|webNavigation|history/clipboardRead→Cookies/Activity/Clipboard(parity)proxy→Proxyaccess badge + refused at load/approval (DisallowedPermission) (upstream allows with no access badge)declarativeNetRequest*→BlockRequestsaccess badge (upstream emits no access badge even withouthost_permissions)management→ManageExtensionsaccess badge + refused at load/approval (DisallowedPermission) (upstream allows with no access badge)debugger,nativeMessaging,downloads(requiredpermissionsonly;optional_permissionssuch as Bitwarden'snativeMessagingstay allowed because Chromium doesn't grant them andchrome.permissions.request()refuses runtime grants) → refused at load/approval (DisallowedPermission) (upstream allowsnativeMessaging/downloadsand allows "Add anyway" ondebugger)externally_connectable&web_accessible_resources→ parsed, surfaced viaExternalConnect/WebAccessiblebadges, and tracked inReviewedGrantsfor update deltas (unparsed upstream)versionparsing (1–4 ASCII digit segments, rejecting bidi/newline/garbage); fail-closed manifest list validation (<= 256items,<= 256chars — eliminatingglob_matchCPU DoS without truncating).icon.rsreads icons via boundedRead::take(64 KiB + 1), verifies magic bytes match file extension (PNG/JPEG/GIF/WebP/ICO;.svgrefused), and enforces pixel dimensions1..=1024 × 1..=1024including embedded ICO PNG/BMP payloads.zip.rs): Enforcescd_end == eocdor verified matching single-disk ZIP64 trailer,disk_number_start == 0, agreement on local-vs-centralmethod,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).crx.rs,manager.rs,sources.rs):is_valid_ext_idbefore URL construction, shared 90 s total deadline across all redirect hops,.https_only(true),RootCerts::PlatformVerifier,ureq::http::Uricross-check, downgrade fallback to installedmanifest.json,is_real_dir+canonicalize(self.root)confinement onrollback_swap/finalize_swap/remove_staging_dir/remove_managed_dir, and symlink-freesources.rs(including macOSdia/comet).Verification & 41/41 Hostile Vector Proof (
proof/ws9/pr2-verifier-proof.json)scripts/guardrails.ps1: 5/5 passed (0 files > 800 lines incrates/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.eimadpbcbfnmbkopoojfekhnkhdbieeh,858,730 B,v4.9.135, SHA-256ea87538ae3d171253f1f74bd2cdafad63da409e6b006922b8bb8e2203ffc651f) downloaded live over HTTPS (PlatformVerifier) and verified; real CWS uBlock Origin Lite & Bitwarden ZIPs validated cleanly (Bitwarden's optionalnativeMessagingstays allowed while required disallowed permissions are blocked).true):crxZipFlipRejected,crxHeaderFlipRejected,crxWrongIdRejectedredirectEvilRefused,redirectCredsRefused,redirectEdgeHttpUpgradedToHttps,invalidStoreTargetIdRefusedallBadZipPathsAndCom0Lpt0DelC1Refused,zip83CollisionOnlyAllowsWebpackRefusesClash,zipForcedZip64AcceptedAndMismatchedRefused,zipQuadraticNestingOomRefused,zipUnicodeCaseAndNfdCollisionRefused,zipUnixMacosWinSymlinkReparseRefused,zipLocalCentralMethodCrcFlagsGapRefused,zipEncryptedRefused,zipCaseDuplicateRefused,zipHeaderDiffRefused,zipBombRefused,zipBadCrcRefusedstoreDowngradeRefused,storeDowngradeMissingStoredVersionFallbackRefusedstagedTamperBetweenReviewAndApproveRefused,installedTamperRefusedAtStartup,windowsReparsePointAndPublicRootRefused,copyDirSafeSelfNestRefusedstateMachineGenRollbackOverflowSwappingTtlHardened,approveStagedOutOfRootNotDeleted,approveStagedWrongTokenRefusedAndCleanedmv2ClassifiedUnsupportedAndBlocked,disallowedRequiredPermsBlockedAndConsistentMissing,manifestPaddingOverLimitRefusedNeverTruncated,updatePortEscalationDetectedInAddedHosts,bitwardenOptionalNativeMessagingStillAllowedreviewTruthfulProxyDnrMgmtExtConnWarAndPortWildcard,reviewMultiLabelWildcardSuffixesPreserved,manifestBidiAndNewlineVersionRejected,globMatchCpuDosBounded,iconMagicAndPixelBombRejected,icoEmbeddedPngAndBmpPixelBombsRejectedlocalFolderPrivateP256KeyAndSites,reviewAddedGrantsDeltaConditions Carried Forward to PRs 3–5
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 enforces0o700on Unix).scope.is_builtin_browser && scope.tool_sid.is_none()), unreachable by agent tools or third-party plugins.approve_stagedswaps on Windows;StoredExtensionis persisted viaopencode-storageonly after engine load succeeds (withrollback_swapon load failure).Proxy,BlockRequests,ManageExtensions,ExternalConnect,WebAccessible, host/site access,addeddeltas) and hard-blocks approval onManifestV2andDisallowedPermission.