You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Runtime currently accepts clients without UID validation; `peer_uid` is derived from `peername` and not enforced: `src/mcpbridge_wrapper/broker/transport.py:189`, `src/mcpbridge_wrapper/broker/transport.py:201`.
37
+
- Socket mode is not explicitly set to `0600` after bind: `src/mcpbridge_wrapper/broker/transport.py:77`.
38
+
- Gap type: security hardening feature not closed.
39
+
40
+
4.**[Medium] Broker startup is not atomic if transport startup fails after upstream launch.**
41
+
- In `start()`, upstream launch + PID file write occur before transport bind/start: `src/mcpbridge_wrapper/broker/daemon.py:109`, `src/mcpbridge_wrapper/broker/daemon.py:112`, `src/mcpbridge_wrapper/broker/daemon.py:127`.
42
+
- If `transport.start()` raises, `start()` exits without cleanup of upstream process or PID/socket state.
43
+
- Gap type: reliability/lifecycle issue under bind/permission/race failures.
- Current guide relies on long inline commands including private attribute mutation (`d._transport=t`): `docs/broker-mode.md:28`, `docs/broker-mode.md:42`, `docs/broker-mode.md:54`.
53
+
- Gap type: maintainability/operability mismatch vs intended productized flow.
54
+
55
+
### Tests and Coverage Gaps
56
+
57
+
- Missing end-to-end runtime test that `--broker-spawn` actually creates a live broker socket (not only mocked spawn paths).
58
+
- Missing transport tests for large/negative integer request IDs to ensure identity preservation.
59
+
- Missing tests for UID rejection behavior (if security boundary is intended to be enforced).
60
+
- Missing failure-path test for `BrokerDaemon.start()` where `transport.start()` fails after upstream launch.
61
+
62
+
### Recommended Follow-Up Tasks
63
+
64
+
1. Implement explicit daemon CLI mode (`--broker-daemon` or `broker host`) in `main()` and add E2E spawn validation.
65
+
2. Replace lossy int-bitmask remap with reversible per-session int-ID mapping (parallel to string ID map), then add regression tests.
66
+
3. Enforce local auth boundary (`getpeereid` same-UID check) and explicit socket permission hardening (`chmod 0600`) with tests.
67
+
4. Make `BrokerDaemon.start()` transactional (cleanup on partial startup failure).
68
+
5. Complete P13-T5 interactive desktop validation and update verdict from PARTIAL to PASS/FAIL with evidence.
-**Description:** Make broker host mode first-class by implementing a real daemon entrypoint (`--broker-daemon` or equivalent broker subcommand) in `__main__.py`, ensuring `--broker-spawn` can reliably auto-start and connect. Replace doc-only one-liner operational flows with supported CLI commands for start/status/stop.
2192
+
-**Priority:** P0
2193
+
-**Dependencies:** P13-T2, P13-T4
2194
+
-**Parallelizable:** no
2195
+
-**Outputs/Artifacts:**
2196
+
- Updated `src/mcpbridge_wrapper/__main__.py` broker daemon branch and command parsing
- Integration test covering `--broker-spawn` end-to-end readiness
2199
+
- Updated `docs/broker-mode.md` and setup docs with first-class broker host commands
2200
+
-**Acceptance Criteria:**
2201
+
-[ ] Running `mcpbridge-wrapper --broker-daemon` starts broker host mode and creates live PID/socket state
2202
+
-[ ]`--broker-spawn` successfully auto-starts broker and connects without manual bootstrap
2203
+
-[ ] No broker-only flags are accidentally forwarded to `xcrun mcpbridge`
2204
+
-[ ] Start/status/stop commands are documented as supported CLI flows (not private inline Python snippets)
2205
+
2206
+
---
2207
+
2208
+
#### ⬜️ FU-P13-T11: Preserve JSON-RPC numeric request ID fidelity in broker transport
2209
+
-**Description:** Remove lossy 20-bit integer ID masking in broker request remapping and implement a reversible per-session ID mapping for numeric IDs so all valid JSON-RPC IDs round-trip exactly.
2210
+
-**Priority:** P1
2211
+
-**Dependencies:** P13-T3
2212
+
-**Parallelizable:** yes
2213
+
-**Outputs/Artifacts:**
2214
+
- Updated `src/mcpbridge_wrapper/broker/transport.py` ID remap/restore strategy
-[ ] Broker transport tests cover ID round-trip fidelity for int and string IDs
2222
+
2223
+
---
2224
+
2225
+
#### ⬜️ FU-P13-T12: Enforce local Unix-socket security boundary for broker clients
2226
+
-**Description:** Implement same-UID peer credential verification for broker socket clients and enforce owner-only socket permissions, aligning runtime behavior with P13-T1 ADR security decisions.
2227
+
-**Priority:** P1
2228
+
-**Dependencies:** P13-T1, P13-T3
2229
+
-**Parallelizable:** yes
2230
+
-**Outputs/Artifacts:**
2231
+
- Updated `src/mcpbridge_wrapper/broker/transport.py` peer credential checks and rejection path
2232
+
- Updated broker socket creation flow to enforce `0600` permissions
2233
+
- Unit tests for accepted/rejected client credential cases
2234
+
- Documentation update in `docs/broker-mode.md` and/or `docs/troubleshooting.md`
2235
+
-**Acceptance Criteria:**
2236
+
-[ ] Broker accepts only same-UID local clients
2237
+
-[ ] Connections failing UID verification are rejected without affecting active sessions
2238
+
-[ ] Broker socket file is owner-readable/writable only (`0600`)
2239
+
-[ ] Security-boundary behavior is documented and test-covered
2240
+
2241
+
---
2242
+
2243
+
#### ⬜️ FU-P13-T13: Make broker startup transactional when transport bind/start fails
2244
+
-**Description:** Harden `BrokerDaemon.start()` so partial startup failures (for example socket bind errors after upstream launch) perform full rollback, leaving no orphaned upstream process or stale PID/socket files.
- Regression tests for transport-start failure after upstream launch
2251
+
- Troubleshooting note for deterministic failure behavior
2252
+
-**Acceptance Criteria:**
2253
+
-[ ] If transport startup fails, upstream subprocess is terminated and waited
2254
+
-[ ] PID/socket files are cleaned up on startup failure
2255
+
-[ ] Broker state returns to a safe non-ready state after rollback
2256
+
-[ ] Unit tests cover rollback behavior and prevent regression
2257
+
2258
+
---
2259
+
2260
+
#### ⬜️ FU-P13-T14: Complete interactive Xcode prompt verification and close P13-T5
2261
+
-**Description:** Execute and document the remaining human-run interactive validation for Xcode permission prompts in direct mode vs broker mode, then update P13-T5 verdict and linked acceptance states.
0 commit comments