Skip to content

feat(ocap-kernel): add allowedWsHosts param to initializeRemoteComms#878

Merged
sirtimid merged 3 commits intomainfrom
sirtimid/platform-services-allowed-ws-hosts
Mar 18, 2026
Merged

feat(ocap-kernel): add allowedWsHosts param to initializeRemoteComms#878
sirtimid merged 3 commits intomainfrom
sirtimid/platform-services-allowed-ws-hosts

Conversation

@sirtimid
Copy link
Contributor

@sirtimid sirtimid commented Mar 17, 2026

Summary

  • Add allowedWsHosts as an optional parameter to the initializeRemoteComms RPC method (struct, type, and handler)
  • Pass allowedWsHosts through to RemoteCommsOptions when provided

Test plan

  • Added param validation tests for allowedWsHosts (accepts valid array, rejects non-array, rejects non-string elements, accepts empty array)
  • Added handler test for passing allowedWsHosts to hook
  • Updated existing "all options" and "not include undefined" tests to include allowedWsHosts
  • All tests pass

🤖 Generated with Claude Code


Note

Medium Risk
Extends a networking-related RPC surface to accept and pass through an allowedWsHosts allowlist, which can affect what websocket targets are permitted. Risk is moderated by strict param validation and focused tests, but misconfiguration could broaden connectivity.

Overview
Adds an optional allowedWsHosts: string[] parameter to the initializeRemoteComms RPC method, validating it via superstruct and passing it through to RemoteCommsOptions only when provided.

Updates/expands unit tests to cover allowedWsHosts validation (accepts arrays including empty, rejects non-arrays and non-string elements) and to assert the handler forwards the option and omits it when undefined.

Written by Cursor Bugbot for commit f99cce3. This will update automatically on new commits. Configure here.

Allow platform services to pass an allowedWsHosts list through the
initializeRemoteComms RPC method to the remote comms options.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sirtimid sirtimid requested a review from a team as a code owner March 17, 2026 15:51
Configure circuitRelayTransport with discoverRelays: 1 so the client
actively seeks and maintains a relay reservation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sirtimid sirtimid changed the title feat(ocap-kernel): add allowedWsHosts param to initializeRemoteComms feat(ocap-kernel): add allowedWsHosts param and enable relay discovery Mar 17, 2026
@sirtimid sirtimid changed the title feat(ocap-kernel): add allowedWsHosts param and enable relay discovery feat(ocap-kernel): add allowedWsHosts param to initializeRemoteComms Mar 17, 2026
@github-actions
Copy link
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 77.27%
⬆️ +0.01%
7802 / 10097
🔵 Statements 77.08%
⬆️ +0.01%
7927 / 10284
🔵 Functions 75.27%
🟰 ±0%
1885 / 2504
🔵 Branches 74.66%
⬆️ +0.01%
3183 / 4263
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/ocap-kernel/src/rpc/platform-services/initializeRemoteComms.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
Generated in workflow #3943 for commit f99cce3 by the Vitest Coverage Report Action

@sirtimid sirtimid enabled auto-merge March 17, 2026 19:32
Comment on lines +74 to +76
if (params.allowedWsHosts !== undefined) {
options.allowedWsHosts = params.allowedWsHosts;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (params.allowedWsHosts !== undefined) {
options.allowedWsHosts = params.allowedWsHosts;
}
const options = { relays, maxRetryAttempts, maxQueue, allowedWsHosts } = params;
return await initializeRemoteComms(
params.keySeed,
ifDefined(options),

Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sirtimid sirtimid added this pull request to the merge queue Mar 18, 2026
Merged via the queue into main with commit 405dd55 Mar 18, 2026
32 checks passed
@sirtimid sirtimid deleted the sirtimid/platform-services-allowed-ws-hosts branch March 18, 2026 00:28
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.

3 participants