- internal/transport/client.go: replace bare &http.Transport{} with
DefaultTransport.Clone() so HTTP_PROXY/HTTPS_PROXY/NO_PROXY, ForceAttemptHTTP2,
IdleConnTimeout, and ExpectContinueTimeout are preserved; only intentionally-tuned
fields (DialContext, TLSHandshakeTimeout, ResponseHeaderTimeout, DisableCompression,
MaxIdleConnsPerHost) are overridden.
- cmd/devbox/main.go: statusCmd disk path now calls control.DialState once upfront;
prints "⚠️ daemon not running — showing last-known disk state (run: devbox start)"
when daemon is absent so users aren't silently misled.
- Tests: TestTransportHonorsProxyEnv asserts Proxy!=nil + ForceAttemptHTTP2=true;
TestStatusDaemonNotRunning asserts warning appears on joined-but-no-daemon device.
Now the hub is WAN-reachable, the transfer path needed real hardening:
- ⏱️ request timeout fix: replaced the 30s TOTAL http.Client.Timeout (which
killed a 256MiB blob mid-transfer over a slow link) with granular dial / TLS /
response-header timeouts + TCP keepalive. Body transfer is no longer wall-clocked.
- 🔁 retry + exponential backoff on transient blob transfers (network / 5xx),
3 attempts; 4xx fails fast. Blob GET/PUT are content-addressed (idempotent),
so retry is safe; control calls are left alone.
- 🚀 parallel blob uploads (push) and parallel chunk downloads (pull reassembly),
bounded pools (8), sharing the existing rate limiter. WAN is RTT-bound — this
keeps the pipe full instead of one-blob-at-a-time.
- 🗜️ download (response) gzip: round 1 compressed only uploads, but a clone is
download-heavy. Client negotiates gzip explicitly (so the rate limiter counts
wire bytes), hub streams the response through gzip, client decompresses
bomb-safely. Gated by the same settings.transfer.compress flag.
Tests: retry transient-then-success + 4xx-no-retry, gzip download round-trip.
All existing push/pull round-trips green under -race (refactors behavior-preserving).
The "changed my mind" feature: deferred as YAGNI on a LAN, but the hub is now
WAN-reachable (port-forwarded), so over-the-internet sync is a real path and
compression earns its keep.
- client (settings.transfer.compress, default off): gzip a blob upload only
when it actually shrinks — incompressible chunks (media, encrypted) go raw so
we never inflate the wire. Sets Content-Encoding: gzip. Wired into the daemon
sync loop and the initial `publish` upload.
- hub: decompresses gzip uploads before hashing, so dedup + content-address
integrity are unchanged. Bomb-safe — caps BOTH the compressed stream
(MaxBytesReader) and the decompressed size (LimitReader), rejecting a gzip
header over a non-gzip body.
Tests: client gzip-when-smaller / raw-when-not, hub decompress round-trip +
bad-gzip rejection. go test ./... -race clean, go vet clean.
P2 adversarial audit (6 finders + skeptic verification, 13 agents). Two real
findings fixed with regression tests; rest documented as single-owner residuals.
- FIX (+s attenuation): MayGrant never constrained the GRANTED reshare bit, so an
invite could confer +s the caller didn't hold (req.Reshare copied verbatim).
MayGrant now takes grantReshare and rejects conferring +s you don't hold (owners
unconstrained) — attenuation is total over role + target + reshare.
- FIX (invite revocation): invites were unrevocable 24h bearer capabilities — no
way to kill a leaked/regretted one. Added meta.RevokeInvite (token+binding in one
tx), POST /v1/invite/revoke (only a caller who could mint it may revoke), and
'devbox invite revoke <token>'.
- Tests: TestMayGrant (+5 +s cases), TestInviteCannotGrantReshareCallerLacks,
TestInviteRevoke. go test ./... -race clean (18 pkgs).
- docs/M8a-audit.md: findings, confirmed defenses, accepted residuals.
Confirmed-defended under attack: single-use redeem (atomic CAS), role bounding,
revoke-at-auth (revoked=0 in bearer+role lookups), cross-share binding, PoP.
- LICENSE: MIT (enables the adoption push; public repo was all-rights-reserved).
- go.mod + all imports: git.shoemoney.ai/shoemoney/devbox -> github.com/shoemoney/devbox,
so outsiders can 'go install github.com/shoemoney/devbox/cmd/devbox@latest'. Forgejo
stays the self-hosted home; the registry (devbox-hub) + public dist (devbox-dist) are
unchanged. vet + build + go test -race all green after the rename.
- README: document the go install path.
Security: full git-history scan (manual blob sweep + gitleaks, 84 commits) found
ZERO secrets — Forgejo token never committed, no keys/passwords/private keys.
Completes M8a's collaboration surface. A member mints an invite; the
invitee redeems it through the EXISTING /v1/join proof-of-possession flow
and lands enrolled + assigned the bound principal + granted the bound role.
- migration #3: invites table (token_hash → principal/share/role/+s),
chains 0→1→2→3 — verified on a copy of the real hub DB.
- POST /v1/invite (authed) enforces ATTENUATION server-side via the pure,
unit-tested meta.MayGrant: never grant above your own role, never touch a
principal who outranks you, viewers can't grant, editors need +s. On a
legacy share the inviter is seeded as owner before the explicit flip so
they (and their same-principal devices) never self-lock-out.
- /v1/join applies a redeemed invite's binding (plain token = v1 join).
- transport.Invite + devbox invite <share> <principal> <role> [--reshare].
Tests: MayGrant attenuation matrix, invite binding round-trip, and the
end-to-end TestInviteFlow (owner invites → flip preserves owner → invitee
redeems into editor → editor-without-+s denied). 18 pkgs -race green;
linux/amd64 + windows cross-build.
The read companion to devbox-hub member set/rm/list. Additive: new
PathMembers endpoint (authed; reads stay open in M8a — gating is M9),
proto.Member/MembersResponse, transport Members(), and a devbox members
<share> client command that prints 'legacy share' or the role grants
(principal, role, +s). Role name<->level mapping moved to meta
(ParseRole/RoleName) and the devbox-hub CLI deduped onto it; new
meta.ACLMode(share). Test: legacy reads empty, a grant flips it explicit
and lists bob/editor/+s. 18 pkgs -race green; windows cross-builds.
The device id is derived from the pubkey in JoinRequest, but the hub never
checked the joiner actually held that key — anyone with a token could enroll
claiming another device's identity. Now the client signs JoinChallenge(token,
pubkey) with its ed25519 private key and the hub verifies it (ed25519.Verify)
BEFORE redeeming the token — so a bad request can't burn a legitimate one-time
token either. proto gains a Signature field + the shared JoinChallenge helper.
Regression test: garbage/missing/wrong-key sigs all 401, token survives, valid
join enrolls.
Two ways a buggy/malicious hub could corrupt the local tree:
- writeEntry/deleteFile joined hub-supplied Entry.Path into root with no
containment check, so '../../.ssh/authorized_keys' wrote/deleted OUTSIDE the
mount. New safeJoin() uses filepath.IsLocal to refuse absolute/.. /escaping
paths before any write or delete.
- GetBlob returned bytes with only an HTTP-status check. Blobs (chunks AND
manifests) are content-addressed, so now verify chunk.Hash(body)==hash —
a corrupt/truncated transfer or hostile hub can't write wrong content
undetected. (manifest ID == chunk.Hash(Marshal()), so the check holds there.)
Regression tests for both.
- pkg/proto + internal/hub/events.go: SSE /v1/events with a broker; hub broadcasts
on genuine head ADVANCE only (idempotent re-push doesn't broadcast -> no storm)
- transport.Client.Events: SSE consumer (timeout-less, ctx-cancelled)
- internal/daemon: per-mount loop funnels watcher + SSE triggers into a serialized
Sync; read-only mounts pull-only; base snapshot persisted in state.json
- cmd/devbox: 'mount <share> <dir> [--ro]' (clone+sync) and 'start' (foreground daemon)
- fix: serialize chunk.Split — jotfs/fastcdc-go mutates a package global in
NewChunker, racing under concurrent chunking (caught by -race)
- test: two live daemons, an edit on one reaches the other automatically (race-clean)