Commit 405dd55
feat(ocap-kernel): add allowedWsHosts param to initializeRemoteComms (#878)
## 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
- [x] Added param validation tests for `allowedWsHosts` (accepts valid
array, rejects non-array, rejects non-string elements, accepts empty
array)
- [x] Added handler test for passing `allowedWsHosts` to hook
- [x] Updated existing "all options" and "not include undefined" tests
to include `allowedWsHosts`
- [x] All tests pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!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.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f99cce3. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent a2a205d commit 405dd55
2 files changed
Lines changed: 70 additions & 0 deletions
File tree
- packages/ocap-kernel/src/rpc/platform-services
Lines changed: 65 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
73 | 109 | | |
74 | 110 | | |
75 | 111 | | |
| |||
562 | 598 | | |
563 | 599 | | |
564 | 600 | | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
565 | 626 | | |
566 | 627 | | |
567 | 628 | | |
| |||
576 | 637 | | |
577 | 638 | | |
578 | 639 | | |
| 640 | + | |
579 | 641 | | |
580 | 642 | | |
581 | 643 | | |
| |||
586 | 648 | | |
587 | 649 | | |
588 | 650 | | |
| 651 | + | |
589 | 652 | | |
590 | 653 | | |
591 | 654 | | |
| |||
620 | 683 | | |
621 | 684 | | |
622 | 685 | | |
| 686 | + | |
623 | 687 | | |
624 | 688 | | |
625 | 689 | | |
| |||
641 | 705 | | |
642 | 706 | | |
643 | 707 | | |
| 708 | + | |
644 | 709 | | |
645 | 710 | | |
646 | 711 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
72 | 77 | | |
73 | 78 | | |
74 | 79 | | |
| |||
0 commit comments