Skip to content

Fix debugger attach with extensions that require networkPolicy - #56

Open
colthreepv wants to merge 1 commit into
DeliciousBuding:mainfrom
colthreepv:fix/attach-network-policy
Open

colthreepv wants to merge 1 commit into
DeliciousBuding:mainfrom
colthreepv:fix/attach-network-policy

Conversation

@colthreepv

Copy link
Copy Markdown

Problem

Debugger attach fails with Chrome extension version 1.26.1102.11740:

Cannot read properties of undefined (reading 'timeoutMs')

The bridge sends attach with only tabId. The extension now passes networkPolicy to its policy manager, which reads timeoutMs and constraints without checking whether the object exists.

Tab discovery and creation still work, so a healthy transport does not reveal this failure.

Fix

Send an explicit policy with no constraints:

{
  "tabId": 123,
  "networkPolicy": {
    "constraints": []
  }
}

Empty constraints preserve the bridge's existing unrestricted networking behavior. In the tested extension, this policy installs no network rules.

Route user-tab claim attachment through the same client helper so both attach paths send the required object. Add regression coverage for the claim path and payload assertions in existing attach tests.

Verification

Reproduced the failure on an isolated tab in Chrome on Windows, using the same session for both requests:

  • Attach without networkPolicy failed with the error above.
  • Attach with empty constraints succeeded.
  • A subsequent CDP Runtime.evaluate call returned 2 for 1 + 1.

Tested the debug build, release build, and installed CLI against the same Chrome instance. Each completed tab creation, navigation to https://example.com/, a DOM snapshot containing Example Domain, and turn finalization.

The extension was not modified. Chrome was not restarted.

All checks passed:

cargo test --locked
cargo check --locked
cargo clippy --locked -- -D warnings
cargo fmt --check
cargo build --locked --release

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