Skip to content

feat: Native Messaging Host — Bypass CSP restrictions in authenticated sessions #15

Description

@Delqhi

Problem

CVE-2026-0628 demonstrated that malicious extensions could hijack authenticated sessions. In response, Chrome tightened CSP restrictions on extensions operating in authenticated contexts. This blocks our content script injection on sites like Prolific.

Evidence

Solution (Implemented)

Created native-host/ directory with:

  1. opensin_host.py — Python stdio-based native messaging host
  2. install_host.sh — Registers the host manifest with Chrome on macOS

The host communicates via stdin/stdout (32-bit length-prefixed JSON), bypassing all browser sandbox and CSP restrictions.

Bonus: connectNative() keeps the MV3 service worker alive indefinitely (bypasses the 30-second termination rule).

Files Changed

  • native-host/opensin_host.py (NEW)
  • native-host/install_host.sh (NEW)

Acceptance Criteria

  • Host installs correctly on macOS via install_host.sh
  • Extension can send/receive JSON messages via native port
  • Service worker stays alive as long as native port is open
  • CSP-blocked pages can still be automated via native host relay

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions