Repository navigation
Commit a776b46
authored
Rewire hub from samod access-policy fork to upstream samod 0.16.0 (#917)
* Rewire hub from samod access-policy fork to upstream samod 0.16.0 (bd-jvag5d4w)
Dependency source: samod + samod-core move from the quarto-dev/samod
`access-policy` branch (0.14.0 + one commit, git+ source in Cargo.lock)
to crates.io samod 0.16.0 (registry source; the lockfile diff is only
the two packages' version/source/checksum lines). automerge stays a
single 0.12.0 and no transitive deps are added or removed — no new
native-tls/openssl edges. quarto-hub, quarto-hub-provider and
quarto-preview switch in lockstep so the crates unify to one copy.
API migration:
- The fork's synchronous `AccessPolicy` patch and `AnnouncePolicy`
(`NeverAnnounce`) are replaced by upstream's `SharePolicy` seam. The
hub installs a constant `ShareConfig::read_write().with_announce(false)`
through a named `hub_share_policy()` seam, pinned by a unit test that
asserts the fields (access=ReadWrite, announce=false) rather than
comparing against the upstream constructor — the security-critical
announce-off behavior, so the hub serves only documents an
authenticated peer actively requests instead of advertising every
loaded document ID.
- `accept_axum(socket)` becomes `accept_axum(socket, None)` (the 0.15
signature). `None` is safe because nothing in the hub authorizes on a
peer ID; bd-07kbzn1d tracks `Transport::with_expected_peer_id` for any
future policy that does.
Audit logging: REMOVED, not ported. The pre-migration spike showed
SharePolicy subscription is eager per (loaded doc, connected peer):
share() fires at connection establishment for every locally loaded
document, before any find(), so a policy-driven "Document accessed"
line would emit phantom accesses for documents the user never opened.
The security audit also found the peer_emails map — keyed by the
client-chosen peer ID — was a misattribution vector (a client claiming
another user's peer ID overwrote, then deleted, that user's entry).
Session-granularity events on the existing quarto_hub::audit target
replace it: `ws_connect` when the upgrade completes (before samod sees
the socket) and `ws_disconnect` when the connection ends, carrying the
samod reason or "stream_closed"; both carry sub/credential_kind and are
emitted only when auth is enabled, matching auth_ok. bd-tfribfyy
records the loss and the design constraints for any replacement.
Also inherits samod 0.15's protocol hardening for free: direct messages
whose sender differs from the handshake identity, or that are addressed
to another peer, are now rejected before dispatch.
Verification: three-crate suite 840/840 (baseline 844 − 7 deleted
access_policy tests + 3 new); clippy/fmt clean; workspace suite
17291/17292 (sole failure a proven worktree-nesting artifact, passes in
the main checkout); JS↔Rust interop 5/5 against the migrated binary;
on-disk smoke loads the pre-migration index without re-init; zero
"Document accessed" lines under -v; two-client ephemeral/presence
check through the hub passes both directions. cargo xtask verify
passes with the npm legs skipped (no node_modules in the worktree, as
in the July migration) and rust-tests/feature-sets covered in-phase.
Plan: claude-notes/plans/2026-10-26-samod-0-16-share-policy.md
Follow-ups: bd-tfribfyy (audit-log loss), bd-07kbzn1d
(with_expected_peer_id), bd-e2l028k4 (cargo deny baseline).
* Plan + braid bookkeeping: mark commit item done (a1dcd15), strand closed
* Simplify ws handler follow-ups from bd-jvag5d4w review
Review follow-ups to a1dcd15 (samod 0.16 SharePolicy rewire):
- Drop the now-dead peer_info.clone() in the ClientConnected arm — it
existed to keep peer_info alive for the removed connected_peer_id
move; nothing uses peer_info afterwards anymore.
- format_peer_info takes Option<&PeerInfo> instead of &Option<PeerInfo>
(idiomatic borrow; unit tests updated).
- ws_disconnect reason is now "repo_stopped" when the repo refuses the
socket, instead of the misleading "stream_closed"; ops doc updated.
This arm is compile-covered only — the test harness has no path to a
stopped repo, same as the pre-existing warn! there.
No snapshot changes. cargo nextest -p quarto-hub: 504/504; clippy
--all-targets -D warnings and fmt clean.1 parent 4d966ea commit a776b46
14 files changed
Lines changed: 777 additions & 335 deletions
File tree
- .braid
- .github/workflows
- claude-notes/plans
- crates
- quarto-hub-provider
- tests/integration
- quarto-hub
- src
- tests/integration
- quarto-preview
- dev-docs/quarto-hub
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
| 49 | + | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
This file was deleted.
0 commit comments