openpencil/tools
Kayshen-X f9f9c8574a fix(collab): harden p2p collaboration against resource exhaustion
Addresses a security review of the collaboration subsystem. No auth
bypass, key leak, or document-plaintext exposure was found; every
finding below is availability or trust-boundary hardening.

Landed as one commit because the pieces are not separable: the
inbound-direction ceiling spans op-collab, op-collab-transport, and the
desktop host atomically, the guarded accept spans transport, smoke, and
the desktop host, and the boundary-gate rules only hold against the
final state. Splitting would produce commits that fail to build or fail
the gate.

Relay server (public, internet-facing):
- Charge pre-pairing capacity per source address. The auth-concurrency
  semaphore was taken before the WebSocket upgrade and the peer address
  was discarded, so one host could pin every permit by connecting and
  going silent.
- Give renewals their own budget. Reauthentication competed for the same
  semaphore, so an unauthenticated flood progressively closed live
  tunnels with a policy error.
- Release the pair registration when the ready status fails to send; the
  counterpart only reclaims it if it reads its pairing notice.
- Require the X25519 key file to be owned by the running user; mode bits
  alone do not establish trust.
- Summarise capacity rejections instead of logging one line each.

Locator service:
- Rate-limit publishes per client instead of process-wide. One
  unauthenticated caller could consume the whole budget and 429 every
  tenant's invite issuance.

Collaboration protocol:
- Size the inbound envelope ceiling from the authenticated remote role
  rather than sharing the 64 MiB snapshot ceiling in both directions, so
  an admitted guest cannot force a 64 MiB JSON parse per frame. The
  ceiling is applied before the discriminator and before the generic
  value decode; a peer-declared snapshot kind cannot raise it.
- Reject display names carrying Unicode format characters, which render
  identically to an existing participant's name.
- Reject avatar URLs pointing at non-globally-routable addresses.

Transport:
- Reclaim a pending-handshake seat from a peer that has not produced a
  valid first handshake message, and raise the global ceiling. Sixteen
  seats held for the full handshake window let four addresses deny every
  join.
- Put inbound reassembly under an aggregate budget; only the outbound
  aggregate was bounded.
- Stop heartbeats from refreshing the idle deadline in receive_transfer.
- Filter IPv4 link-local discovery advertisements, matching IPv6.

Relay client and trust roots:
- Bound server-initiated reauthentication per connection by count and
  minimum interval, sized from the protocol's own cadence.
- Close the policy-file TOCTOU window by identity-checking the opened
  file, and reject group/world-writable or foreign-owned policy files.
- Stop discarding bootstrap cache-write failures, which silently
  disabled the anti-rollback generation floor.
2026-08-01 09:48:23 +08:00
..
bundle-macos.sh feat(collab): add authenticated p2p collaboration 2026-07-29 00:06:58 +08:00
check-collab-deployment-boundaries.sh fix(collab): harden p2p collaboration against resource exhaustion 2026-08-01 09:48:23 +08:00
check-collab-security-boundaries-cases.sh fix(collab): harden p2p collaboration against resource exhaustion 2026-08-01 09:48:23 +08:00
check-collab-security-boundaries.sh fix(collab): harden p2p collaboration against resource exhaustion 2026-08-01 09:48:23 +08:00
check-collab-security-boundaries.test.sh fix(collab): harden p2p collaboration against resource exhaustion 2026-08-01 09:48:23 +08:00
check-jian-boundaries.sh fix(editor): improve import and generation reliability 2026-07-21 06:34:53 +08:00
check-macos-bundle-plist.sh feat(collab): add authenticated p2p collaboration 2026-07-29 00:06:58 +08:00
check-macos-bundle-plist.test.sh feat(collab): add authenticated p2p collaboration 2026-07-29 00:06:58 +08:00
check-op-auth-prebuilt.sh feat(collab): add authenticated p2p collaboration 2026-07-29 00:06:58 +08:00
check-op-auth-prebuilt.test.sh feat(collab): add authenticated p2p collaboration 2026-07-29 00:06:58 +08:00
check-version-sync-policy.test-cases.sh fix: enforce centralized version inputs 2026-07-15 21:17:21 +08:00
check-version-sync.sh fix(agent): retire gemini cli provider, add antigravity and grok build 2026-07-24 21:11:15 +08:00
check-version-sync.test.sh fix(agent): retire gemini cli provider, add antigravity and grok build 2026-07-24 21:11:15 +08:00
check-wasm-bundle.sh merge: land the align-branch work onto the refreshed base 2026-07-03 00:08:17 +08:00
check-web-browser-smoke.sh test(web): add rust web browser smoke 2026-06-20 19:24:59 +08:00
check-web-server-headless.sh refactor(host): rename op-web-daemon crate to op-host-services 2026-06-19 22:35:22 +08:00
check-widget-boundary.sh feat(sdk): add op-web-sdk read-only web viewer crate 2026-06-19 17:52:12 +08:00
convert-locales.py feat(i18n): complete locale coverage across menus, providers, and panels 2026-07-26 11:24:06 +08:00
fetch-skia-artifact.sh build(step-1b): add tools/fetch-skia-artifact.sh (Variant A release path) 2026-05-09 21:04:00 +08:00
macos-local-network-plist.sh feat(collab): add authenticated p2p collaboration 2026-07-29 00:06:58 +08:00
merge-settings-i18n.py fix(agent): retire gemini cli provider, add antigravity and grok build 2026-07-24 21:11:15 +08:00
package-op-auth-prebuilt.sh feat(collab): add authenticated p2p collaboration 2026-07-29 00:06:58 +08:00