Skip to content

feat(extension): bound native messaging frame codec - #213

Closed
seonghobae wants to merge 9 commits into
feat/native-messaging-host-authorityfrom
feat/native-messaging-frame-codec
Closed

feat(extension): bound native messaging frame codec#213
seonghobae wants to merge 9 commits into
feat/native-messaging-host-authorityfrom
feat/native-messaging-frame-codec

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Partial implementation of #27, stacked on exact current #82 head c639cd78e3acad235be4cbbfdef67b84ce7ddbfa.

Buyer/security boundary

This Draft adds the next separately reviewed native-messaging boundary after exact extension-to-host authority: a bounded Chrome native-messaging frame codec. It uses the official Chrome framing contract without promoting transport bytes into process, registration, Agent, or secret authority.

The production boundary:

  • prefixes outbound UTF-8 text with one native-endian unsigned 32-bit byte length;
  • enforces Chrome's direction-specific maximums: 1 MiB native-host → Chrome and 64 MiB Chrome → native-host;
  • validates the declared size before interpreting the body;
  • requires the supplied input to contain exactly one complete frame, rejecting both truncation and trailing bytes;
  • rejects non-UTF-8 payloads fail closed; and
  • emits deterministic error text that does not reflect attacker-controlled payload bytes.

This layer deliberately does not spawn or supervise a native process, parse JSON syntax or schemas, authenticate operating-system host registration, trust Chrome's process arguments as OriginWeave authorization, grant Agent capability, carry secrets, or weaken #82's exact extension-to-host authority boundary.

Test-first evidence

The realistic regression was established before production support. Exact test-only head 3d9b8a2f0468848f7f3eeaeb13ac75c0798da0e8 reached the intended compiler boundary: CI checked out that exact head and failed cargo check --locked --workspace --all-targets with unresolved production imports for NativeMessagingFrameDirection, NativeMessagingFrameError, decode_native_messaging_frame, and encode_native_messaging_frame.

The same canonical branch then received the minimal production implementation, exact-limit encoding coverage, all deterministic error-display branches, the primary-source doctoring update, and the Unreleased changelog record. A source-only rustfmt defect surfaced on an intermediate exact head and was repaired by applying the canonical formatter output rather than changing semantics.

Exact-current verification

Current exact contributor head is 57dc0b4886cff1dc22a2ab1c251c5e5bff84158e; GitHub reports this Draft open and mergeable against exact prerequisite #82.

On this unchanged exact head:

  • CI run 32461885323: success;
    • Rust contracts job 96710344984: repository contracts, canonical formatting, locked workspace/all-target check, full tests, strict Clippy, and rustdoc success;
    • Production coverage job 96710345129: exact owned-production function, line, region, and branch coverage enforcement success;
  • Manifest V3 Compatibility run 32461885241: success;
  • SAST Semgrep run 32461885233: queued at the latest bounded refetch; and
  • Security Scan run 32461885346: queued at the latest bounded refetch.

Queued scanners are continuation evidence and are not represented as passing. Fresh formal-review inventory contains no submitted reviews and fresh inline-review inventory contains no threads. No predecessor, prerequisite, queued, skipped, cancelled, synthetic, status-only, or model-only result is promoted as current proof.

Standards / truth boundary

docs/doctoring/browser-agent-protocols.md now records Chrome's current native-messaging contract and keeps framing distinct from manifest/OS registration, process identity/supervision, caller-origin binding, JSON schema validation, extension-to-host authority, Agent capability, and secret disclosure. The current framing layer is only a reusable byte-level transport primitive.

Keep this PR Draft while #82 remains active. Protected-main AGENTS.md forbids this scheduled actor from merging, self-approving, altering workflows, adding secrets, weakening checks, tagging, or publishing.

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f85c6048-a62e-49bc-aced-44c722a8b43b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Contributor Author

Closing as a proven duplicate of the earlier canonical framing owner #154 (feat/native-messaging-framing-boundary, exact head 4a71b7dd357974f791f8d7f4a0be5c4c0b9ea1b1). Fresh comparison against the shared exact #82 base shows #154 already owns the production boundary this branch attempted to add: native-endian 32-bit framing, 1 MiB host→browser / 64 MiB browser→host limits, oversized-length rejection before body slicing/allocation, exact total-frame-length equality, UTF-8 text validation, deterministic source-free errors, TDD evidence, changelog, and primary-source doctoring. Its current tests also cover Unicode UTF-8 text and every error-display variant; the #213 exact-limit/diagnostic regressions do not establish a distinct missing production contract. #169 already depends on #154, confirming #154 as the dependency-root owner. No #213 checks/reviews are transferred to #154, and #154's existing exact-head evidence remains independently authoritative.

@seonghobae seonghobae closed this Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant