carlos / platform Public

Strip visitor header aliases and cache whois deadlines (#486 A)

Close the final review identity-spoofing finding by normalizing underscores
to hyphens before matching reserved visitor headers and trailers. Cover
mixed spellings on anonymous and identified Unix upstreams and upgrades.

Apply R11: cache expired lookup contexts as five-second anonymous failures,
while keeping explicit cancellation uncached. Add fake-clock expiry and
front-door timeout regressions. The header normalization mutation is caught.

Targeted edge tests, one race run, Darwin edge build and census checks pass.
Reseal the existing census proposal; no 9B8 digest changes are needed.
Other review minors remain follow-ups. Independent verdicts stay with the
controller and reviewer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 2a787bd22c2b29d49e706267e04752682ee6e6ce parent 8ac70ab
7 files changed, +145 −18
  • docs/superpowers/notes/census-proposal-devbox-identity.md +2 −2
  • internal/edge/devboxfront.go +3 −1
  • internal/edge/devboxfront_test.go +78 −4
  • internal/edge/visitor.go +9 −3
  • internal/edge/visitor_test.go +45 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-devbox-identity.tsv +7 −7

CI passed — run details

diff --git a/docs/superpowers/notes/census-proposal-devbox-identity.md b/docs/superpowers/notes/census-proposal-devbox-identity.md
index 31f3bcdc3..e0c2f69fe 100644
--- a/docs/superpowers/notes/census-proposal-devbox-identity.md
+++ b/docs/superpowers/notes/census-proposal-devbox-identity.md
@@ -10,7 +10,7 @@ Ruling `census-ruling-devbox-identity`. The independent reviewer approves or rej
| `internal/devbox/registrar.go` `Registrar.serveShareLive` | body | unchanged (1) | #486 A: the carlos-devbox service user, not root, now reads and validates the request JSON allow list, stores the normalized list with the local link, and returns owner-filtered allow details through entry(link, uid). Existing SO_PEERCRED identity, claim ownership/registry reads and UpsertUnlessRootfs remain; no new filesystem or deployment-record read. |
| `internal/devbox/registrar.go` `Registrar.serveUnshare` | body | unchanged (1) | #486 A: the carlos-devbox service user, not root, now passes the authenticated caller UID to entry(prev, uid) so the response exposes allow names only to their owner. Reads the same local link and registry row, checks ownership, then deletes with the existing rollback; no new read. |
| `internal/devbox/registrar.go` `Registrar.serveShareFolder` | sites | -file:Query | #486 A: the carlos-devbox service user, not root, replaces req.URL.Query with strict url.ParseQuery(req.URL.RawQuery), refuses malformed query encoding, and validates repeated allow values before reading the capped upload body. Stores the normalized allow list in its local links.json and returns owner-filtered entry data. The scanner loses file:Query; existing archive, spool and local registry reads remain, with no new filesystem or deployment-record read. |
-| `internal/edge/edge.go` `Edge.Reload` | sites | +registry:Socket | #486 A: only the devbox edge created by newDevboxEdge (carlos-devbox service user, not root) enables the new proxy hooks. Saves the existing DispatchArm result and reads t.Socket from an already-listed route when that arm is ArmSocket, passing it to configureDevboxProxy for per-request expected-owner validation and visitor-header rewriting. Adds one registry:Socket field site; no new registry query or file open, and ordinary fleet/agent edges leave the hook disabled. |
+| `internal/edge/edge.go` `Edge.Reload` | sites | +registry:Socket | #486 A: only the devbox edge created by newDevboxEdge (carlos-devbox service user, not root) enables the new proxy hooks. Saves the existing DispatchArm result and reads t.Socket from an already-listed route when that arm is ArmSocket, passing it to configureDevboxProxy for per-request expected-owner validation and visitor-header rewriting. Adds one registry:Socket field site; no new registry query or file open, and ordinary fleet/agent edges leave the hook disabled. Final fix wave: its devbox-only outgoing-header/trailer hooks now also strip case-insensitive underscore/hyphen aliases through stripVisitorHeaders; no new read. |
Envelopes re-pinned: `.`, `infra/devbox`, `internal/devbox`, `internal/edge`, `internal/tsidentity`.
@@ -36,6 +36,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/edge/devboxfront.go:devboxTrailerBody.Read`: reads +file:Read ×2; written legacy, accepted-legacy, frozen
- new `internal/tsidentity/whois.go:identity.Who`: reads +file:ReadAll; written legacy, accepted-legacy, frozen
-Seal: `df8bf8056d80b9d78edc957fe7f2adbc75885e15f581e58167768346c4e05771` → `988b61f1f23566877e4287f7dc4c81de152dc85cfa7f1cb5cbd80f5d87e49eda`.
+Seal: `df8bf8056d80b9d78edc957fe7f2adbc75885e15f581e58167768346c4e05771` → `e84b9c60639848d7f18fab0d0ad65cf8bb32005c070db5f8ad08481a926e93bc`.
Overlay: `internal/provision/testdata/plan14-root-reads-devbox-identity.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/edge/devboxfront.go b/internal/edge/devboxfront.go
index 1bef459cf..f3a38455b 100644
--- a/internal/edge/devboxfront.go
+++ b/internal/edge/devboxfront.go
@@ -104,7 +104,9 @@ func (b *devboxTrailerBody) Read(p []byte) (int, error) {
func stripVisitorHeaders(h http.Header) {
for key := range h {
- if strings.EqualFold(key, "Carlos-Visitor-Login") || strings.EqualFold(key, "Carlos-Visitor-Name") || strings.EqualFold(key, "Carlos-Visitor-Node") {
+ // CGI, Rack and WSGI fold underscores and hyphens to the same key.
+ name := strings.ReplaceAll(key, "_", "-")
+ if strings.EqualFold(name, "Carlos-Visitor-Login") || strings.EqualFold(name, "Carlos-Visitor-Name") || strings.EqualFold(name, "Carlos-Visitor-Node") {
delete(h, key)
}
}
diff --git a/internal/edge/devboxfront_test.go b/internal/edge/devboxfront_test.go
index 349da722a..6743ee9dc 100644
--- a/internal/edge/devboxfront_test.go
+++ b/internal/edge/devboxfront_test.go
@@ -39,13 +39,29 @@ func assertNoVisitorHeaders(t *testing.T, h http.Header) {
t.Helper()
for k := range h {
for _, name := range []string{"Carlos-Visitor-Login", "Carlos-Visitor-Name", "Carlos-Visitor-Node"} {
- if strings.EqualFold(k, name) {
+ if strings.ToUpper(strings.ReplaceAll(k, "-", "_")) == strings.ToUpper(strings.ReplaceAll(name, "-", "_")) {
t.Errorf("visitor header remains: %q = %q", k, h[k])
}
}
}
}
+// CGI/Rack/WSGI map every separator combination to the same variable.
+var frontVisitorAliases = []string{
+ "cArLoS_Visitor_Login", "Carlos_Visitor-Login", "Carlos-Visitor_Login",
+ "cArLoS_Visitor_Name", "Carlos_Visitor-Name", "Carlos-Visitor_Name",
+ "cArLoS_Visitor_Node", "Carlos_Visitor-Node", "Carlos-Visitor_Node",
+}
+
+func assertNoVisitorAliases(t *testing.T, h http.Header) {
+ t.Helper()
+ rest := h.Clone()
+ for _, name := range []string{"Carlos-Visitor-Login", "Carlos-Visitor-Name", "Carlos-Visitor-Node"} {
+ rest.Del(name)
+ }
+ assertNoVisitorHeaders(t, rest)
+}
+
func TestFrontStripsVisitorHeaders(t *testing.T) {
for _, upgrade := range []bool{false, true} {
t.Run(map[bool]string{false: "ordinary", true: "upgrade"}[upgrade], func(t *testing.T) {
@@ -54,6 +70,9 @@ func TestFrontStripsVisitorHeaders(t *testing.T) {
"Carlos-Visitor-Login": {"forged"}, "cArLoS-vIsItOr-LoGiN": {"forged too"},
"carlos-visitor-name": {"forged"}, "CARLOS-VISITOR-NODE": {"forged"},
}
+ for _, name := range frontVisitorAliases {
+ r.Header[name] = []string{"forged alias"}
+ }
if upgrade {
r.Header.Set("Connection", "Upgrade")
r.Header.Set("Upgrade", "websocket")
@@ -268,6 +287,7 @@ func TestDevboxFrontUnixUpstreamIdentityAndOwner(t *testing.T) {
var calls atomic.Int32
path := frontSocketBackend(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
calls.Add(1)
+ assertNoVisitorAliases(t, r.Header)
for k, want := range map[string]string{"Carlos-Visitor-Login": frontVisitor.Login, "Carlos-Visitor-Name": frontVisitor.Name, "Carlos-Visitor-Node": frontVisitor.Node} {
if got := r.Header.Get(k); got != want {
t.Errorf("upstream %s=%q want=%q", k, got, want)
@@ -307,6 +327,9 @@ func TestDevboxFrontUnixUpstreamIdentityAndOwner(t *testing.T) {
r := frontRequest()
r.Host = "shop.example.com:443"
r.Header.Set("Carlos-Visitor-Login", "mallory@github")
+ for _, name := range frontVisitorAliases {
+ r.Header[name] = []string{"forged alias"}
+ }
r.Header["cArLoS-vIsItOr-LoGiN"] = []string{"forged"}
r.Header.Set("Connection", "Carlos-Visitor-Login, Carlos-Visitor-Name, Carlos-Visitor-Node")
@@ -474,8 +497,13 @@ func TestFrontPrintableASCIIBoundaries(t *testing.T) {
func frontTrailerRequest(t *testing.T) *http.Request {
t.Helper()
- raw := "POST / HTTP/1.1\r\nHost: shop.example.com\r\nTransfer-Encoding: chunked\r\nTrailer: Carlos-Visitor-Login, Carlos-Visitor-Name, Carlos-Visitor-Node, X-Other\r\n\r\n" +
- "4\r\nbody\r\n0\r\ncArLoS-vIsItOr-LoGiN: mallory@github\r\ncarlos-visitor-name: Mallory\r\nCARLOS-VISITOR-NODE: forged\r\nX-Other: preserved\r\n\r\n"
+ declared := append([]string{"Carlos-Visitor-Login", "Carlos-Visitor-Name", "Carlos-Visitor-Node", "X-Other"}, frontVisitorAliases...)
+ raw := "POST / HTTP/1.1\r\nHost: shop.example.com\r\nTransfer-Encoding: chunked\r\nTrailer: " + strings.Join(declared, ", ") + "\r\n\r\n" +
+ "4\r\nbody\r\n0\r\ncArLoS-vIsItOr-LoGiN: mallory@github\r\ncarlos-visitor-name: Mallory\r\nCARLOS-VISITOR-NODE: forged\r\nX-Other: preserved\r\n"
+ for _, name := range frontVisitorAliases {
+ raw += name + ": forged alias\r\n"
+ }
+ raw += "\r\n"
r, err := http.ReadRequest(bufio.NewReader(strings.NewReader(raw)))
if err != nil {
t.Fatal(err)
@@ -488,6 +516,9 @@ func frontTrailerRequest(t *testing.T) *http.Request {
func TestFrontStripsVisitorTrailers(t *testing.T) {
r := frontTrailerRequest(t)
r.Trailer["cArLoS-vIsItOr-LoGiN"] = []string{"already populated"}
+ for _, name := range frontVisitorAliases {
+ r.Trailer[name] = []string{"already populated alias"}
+ }
cfg := DevboxConfig{Identity: visitorIdentityFunc(func(context.Context, netip.AddrPort) (Visitor, bool, error) {
assertNoVisitorHeaders(t, r.Trailer)
return frontVisitor, true, nil
@@ -542,7 +573,9 @@ func TestFrontIdentityDeadline(t *testing.T) {
t.Run(fmt.Sprintf("private=%v", private), func(t *testing.T) {
synctest.Test(t, func(t *testing.T) {
started := time.Now()
+ lookups := 0
cfg := DevboxConfig{Identity: visitorIdentityFunc(func(ctx context.Context, _ netip.AddrPort) (Visitor, bool, error) {
+ lookups++
deadline, ok := ctx.Deadline()
if !ok {
t.Error("lookup has no deadline")
@@ -554,6 +587,7 @@ func TestFrontIdentityDeadline(t *testing.T) {
<-ctx.Done()
return Visitor{}, false, ctx.Err()
})}
+ cfg.Identity = NewCachedIdentity(cfg.Identity, time.Now)
if private {
cfg.AllowFor = func(string) []string { return []string{frontVisitor.Login} }
}
@@ -577,6 +611,12 @@ func TestFrontIdentityDeadline(t *testing.T) {
if elapsed := time.Since(started); elapsed != 2*time.Second {
t.Errorf("elapsed=%s want=2s", elapsed)
}
+ cachedStart := time.Now()
+ w = httptest.NewRecorder()
+ h.ServeHTTP(w, frontRequest())
+ if w.Code != wantCode || lookups != 1 || time.Since(cachedStart) != 0 {
+ t.Errorf("cached timeout: code=%d lookups=%d elapsed=%s", w.Code, lookups, time.Since(cachedStart))
+ }
})
})
}
@@ -590,6 +630,7 @@ func TestDevboxFrontUnixUpgrade101(t *testing.T) {
echo := upgradeEchoHandler("socket")
path := frontSocketBackend(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
defer close(done)
+ assertNoVisitorAliases(t, r.Header)
for k, want := range map[string]string{"Carlos-Visitor-Login": frontVisitor.Login, "Carlos-Visitor-Name": frontVisitor.Name, "Carlos-Visitor-Node": frontVisitor.Node} {
if got := r.Header.Get(k); got != want {
t.Errorf("upstream %s=%q want=%q", k, got, want)
@@ -619,7 +660,7 @@ func TestDevboxFrontUnixUpgrade101(t *testing.T) {
if err := conn.SetDeadline(time.Now().Add(5 * time.Second)); err != nil {
t.Fatal(err)
}
- _, err = fmt.Fprint(conn, "GET /ws HTTP/1.1\r\nHost: shop.example.com\r\nConnection: Upgrade, Carlos-Visitor-Login, Carlos-Visitor-Name, Carlos-Visitor-Node\r\nUpgrade: websocket\r\ncArLoS-vIsItOr-LoGiN: mallory@github\r\nCarlos-Visitor-Name: Forged\r\nCarlos-Visitor-Node: Forged\r\n\r\n")
+ _, err = fmt.Fprint(conn, "GET /ws HTTP/1.1\r\nHost: shop.example.com\r\nConnection: Upgrade, Carlos-Visitor-Login, Carlos-Visitor-Name, Carlos-Visitor-Node\r\nUpgrade: websocket\r\ncArLoS-vIsItOr-LoGiN: mallory@github\r\nCarlos-Visitor-Name: Forged\r\nCarlos-Visitor-Node: Forged\r\ncArLoS_Visitor_Login: forged\r\nCarlos_Visitor-Name: forged\r\nCarlos-Visitor_Node: forged\r\n\r\n")
if err != nil {
t.Fatal(err)
}
@@ -644,3 +685,36 @@ func TestDevboxFrontUnixUpgrade101(t *testing.T) {
t.Fatal("upgraded upstream did not finish")
}
}
+
+func TestDevboxFrontUnixAnonymousAliases(t *testing.T) {
+ if runtime.GOOS != "linux" {
+ t.Skip("socket identities require Linux")
+ }
+ path := frontSocketBackend(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ assertNoVisitorHeaders(t, r.Header)
+ assertNoVisitorHeaders(t, r.Trailer)
+ if _, err := io.Copy(io.Discard, r.Body); err != nil {
+ t.Error(err)
+ }
+ assertNoVisitorHeaders(t, r.Trailer)
+ w.WriteHeader(http.StatusNoContent)
+ }))
+ reg := openReg(t)
+ if err := reg.Upsert(registry.Route{Host: "shop.example.com", Kind: "service", Socket: path, Status: "ready"}); err != nil {
+ t.Fatal(err)
+ }
+ cfg := DevboxConfig{Registry: reg, SpoolRoot: t.TempDir(), SocketOwnerFor: func(string) (string, uint32, bool) { return path, uint32(os.Getuid()), true }}
+ e, err := newDevboxEdge(cfg)
+ if err != nil {
+ t.Fatal(err)
+ }
+ r := frontTrailerRequest(t)
+ for _, name := range frontVisitorAliases {
+ r.Header[name] = []string{"forged alias"}
+ }
+ w := httptest.NewRecorder()
+ devboxFront(e, cfg, frontSelf).ServeHTTP(w, r)
+ if w.Code != http.StatusNoContent {
+ t.Fatalf("code=%d want=204", w.Code)
+ }
+}
diff --git a/internal/edge/visitor.go b/internal/edge/visitor.go
index a4222ddad..e52cd610b 100644
--- a/internal/edge/visitor.go
+++ b/internal/edge/visitor.go
@@ -36,7 +36,8 @@ type cachedIdentity struct {
// NewCachedIdentity caches identities by unmapped IP for 60 seconds, and
// misses or errors for 5 seconds. Cached errors return an anonymous miss with
-// nil error. Canceled lookups and panics are not cached; waiters retry.
+// nil error. Deadlines are cached as failures; explicit caller cancellation
+// and panics are not cached, so waiters retry.
// At 4096 entries, a new IP resets the cache to bound memory.
func NewCachedIdentity(inner VisitorIdentity, now func() time.Time) VisitorIdentity {
return &cachedIdentity{inner: inner, now: now, entries: make(map[netip.Addr]*visitorCacheEntry)}
@@ -98,8 +99,13 @@ func (c *cachedIdentity) lookup(ctx context.Context, remote netip.AddrPort, entr
// Keep the full AddrPort for the provider. If this caller cancels, the
// other callers retry under their own contexts instead of caching a miss.
visitor, ok, err := c.inner.Who(ctx, remote)
- if ctx.Err() != nil {
- return Visitor{}, false, ctx.Err()
+ if ctxErr := ctx.Err(); ctxErr != nil {
+ if errors.Is(ctxErr, context.Canceled) {
+ return Visitor{}, false, ctxErr
+ }
+ // R11: a deadline is a lookup failure, even if the provider returned
+ // an answer after its budget expired. Cache the miss for five seconds.
+ err = ctxErr
}
if errors.Is(err, context.Canceled) {
return Visitor{}, false, err
diff --git a/internal/edge/visitor_test.go b/internal/edge/visitor_test.go
index 08aaa95a8..042f38294 100644
--- a/internal/edge/visitor_test.go
+++ b/internal/edge/visitor_test.go
@@ -27,6 +27,7 @@ func TestCachedIdentityTTLs(t *testing.T) {
{"hit", true, nil, 60 * time.Second},
{"miss", false, nil, 5 * time.Second},
{"error", true, errors.New("lookup failed"), 5 * time.Second},
+ {"provider deadline", true, context.DeadlineExceeded, 5 * time.Second},
} {
t.Run(tc.name, func(t *testing.T) {
now := time.Unix(1000, 0)
@@ -283,3 +284,47 @@ func TestAnonymousSource(t *testing.T) {
})
}
}
+
+func TestCachedIdentityDeadlineFailureTTL(t *testing.T) {
+ for _, lateSuccess := range []bool{false, true} {
+ name := "deadline error"
+ if lateSuccess {
+ name = "answer after deadline"
+ }
+ t.Run(name, func(t *testing.T) {
+ synctest.Test(t, func(t *testing.T) {
+ now := time.Unix(1000, 0)
+ calls := 0
+ want := Visitor{Login: "alice@github"}
+ identity := NewCachedIdentity(visitorIdentityFunc(func(ctx context.Context, _ netip.AddrPort) (Visitor, bool, error) {
+ calls++
+ if calls == 1 {
+ <-ctx.Done()
+ if lateSuccess {
+ return want, true, nil
+ }
+ return Visitor{}, false, ctx.Err()
+ }
+ return want, true, nil
+ }), func() time.Time { return now })
+ remote := netip.MustParseAddrPort("100.64.0.2:1234")
+ ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
+ defer cancel()
+ v, ok, err := identity.Who(ctx, remote)
+ if v != (Visitor{}) || ok || !errors.Is(err, context.DeadlineExceeded) {
+ t.Fatalf("deadline = %+v, %v, %v", v, ok, err)
+ }
+ now = now.Add(5*time.Second - time.Nanosecond)
+ v, ok, err = identity.Who(context.Background(), remote)
+ if v != (Visitor{}) || ok || err != nil || calls != 1 {
+ t.Fatalf("cached deadline = %+v, %v, %v; calls %d", v, ok, err, calls)
+ }
+ now = now.Add(time.Nanosecond)
+ v, ok, err = identity.Who(context.Background(), remote)
+ if v != want || !ok || err != nil || calls != 2 {
+ t.Fatalf("after expiry = %+v, %v, %v; calls %d", v, ok, err, calls)
+ }
+ })
+ })
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index f3a248f00..24793a284 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -58,4 +58,4 @@ plan14-root-reads-rootfs-default-home.tsv 7a0a3da3d6fe7e3c77abb22676db000af2a276
plan14-root-reads-probe-burst-limit.tsv 5f805400717bad7726bd9d62744b8103a40eb5f5823b0ab7c960a5c0965cb3bc
plan14-root-reads-region-ha-p1b3a.tsv 5d20b3777026e43906bfba301186bce0ae58daa9d8ad5019879b7833f14dc6ff
plan14-root-reads-stateless-replicas-1.tsv df8bf8056d80b9d78edc957fe7f2adbc75885e15f581e58167768346c4e05771
-plan14-root-reads-devbox-identity.tsv 988b61f1f23566877e4287f7dc4c81de152dc85cfa7f1cb5cbd80f5d87e49eda
+plan14-root-reads-devbox-identity.tsv e84b9c60639848d7f18fab0d0ad65cf8bb32005c070db5f8ad08481a926e93bc
diff --git a/internal/provision/testdata/plan14-root-reads-devbox-identity.tsv b/internal/provision/testdata/plan14-root-reads-devbox-identity.tsv
index fe619afbd..27eca6745 100644
--- a/internal/provision/testdata/plan14-root-reads-devbox-identity.tsv
+++ b/internal/provision/testdata/plan14-root-reads-devbox-identity.tsv
@@ -11,10 +11,10 @@
@legacy d6ccdaaa66c2b308b077a67d08300103d618a914fd57f6717fb00180a5c95669 internal/devbox/registrar.go Registrar.serveShareSocket legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-identity;basis=#486 A: the carlos-devbox service user, not root, decodes name/path/allow from the SO_PEERCRED-authenticated request, validates name/list, and calls checkSocket for direct-child path, inode owner/type and connected peer UID. Under its mutex it reads its local link/registry claim, persists a socket link in links.json and constructs the whole registry.Route passed to UpsertUnlessRootfs, with rollback on failure. No deployment bucket/record read; socket-path refusals return the configured directory as machine data. whole:Route@1231 b3389aa29c77785657375b60208aac3ac4a086baf9b2c24be4d7d6d98e12791c
@legacy 199bf1e752ba186ccfc21f14976e7c05ffb3ff6dc39eb5b993a8dea04f8497cc internal/devbox/socketcheck_linux.go checkSocket legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-identity;basis=#486 A: the carlos-devbox service user, not root, validates the cleaned absolute socket path is directly inside its configured directory, opens with O_PATH|O_NOFOLLOW|O_CLOEXEC, and uses socketFstat to require a socket owned by the kernel-authenticated caller UID. Then a bounded connect and SO_PEERCRED lookup require the listening process to have that same UID. New reads are socket inode metadata and peer credentials, with no request payload sent and no file content read. file:Open@338 1eaaca6537d425a9bf1c6e507dc46d6814538676d022eac1fb79b331e5efa61b
@legacy 59bb57b3c10ca15f1581b4f608d5ce65a4e0cd007ad2fb311a6a5045ad816361 internal/devbox/socketcheck_linux.go var#1 legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-identity;basis=#486 A: production assigns socketFstat=unix.Fstat and socketPeerUID=PeerUID as test seams for checkSocket. The carlos-devbox service user, not root, later uses these functions for the opened socket inode metadata and connected peer UID. The new file:Fstat site is a function value here; initialization itself performs no I/O. file:Fstat@23 aeebbb8ef221155002eec748d1269875edeceb1e199d85086bc6d1e829be6e91
-@legacy 1762fc326ab0e7d653a304de013b4d574baf3fc8dc251e0545f395a7ae9836d8 internal/edge/devboxfront.go devboxTrailerBody.Read legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-identity;basis=#486 A: the carlos-devbox service user, not root, reads the incoming HTTP request body through its wrapped ReadCloser. At EOF it strips all visitor identity trailer names before a handler can use late-populated trailers. The scanner counts Read identifiers as file reads; these are network request-body reads, not filesystem opens or root-owned data. file:Read@28,file:Read@69 66eacb35174eb545872491665ef53c06c92a740c973a012825d67a3126abdfbc
-@legacy eeb99e713d808bad55b9fba9417ff87b22841ce90d6bfc3265691f6693dba97a internal/tsidentity/whois.go identity.Who legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-identity;basis=#486 A: the carlos-devbox service user, not root, queries tailscaled LocalAPI whois over the configured Unix socket (default /var/run/tailscale/tailscaled.sock) for the visitor remote address. New ReadAll reads at most 1 MiB plus one overflow byte from the HTTP response; redirects/errors and oversized or malformed JSON fail, and tagged devices or missing logins are anonymous. No ordinary file or deployment-record read; timeout/cancellation are bounded by the adapter and front door. file:ReadAll@748 faa815685cac4ee4cae548179dbd45e1e852bc5b1a9a13ab899d59ef0670747b
+@legacy 8d141edc4545a978b8220d5103b667cc1d9bbf086ac502c5ce73981a742ff745 internal/edge/devboxfront.go devboxTrailerBody.Read legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-identity;basis=#486 A: the carlos-devbox service user, not root, reads the incoming HTTP request body through its wrapped ReadCloser. At EOF it strips all visitor identity trailer names before a handler can use late-populated trailers. The scanner counts Read identifiers as file reads; these are network request-body reads, not filesystem opens or root-owned data. Final fix wave: the shared stripping helper now normalizes underscores to hyphens for comparisons, covering late EOF trailers as well as request and outgoing headers/trailers; this Read body and its reads are unchanged. file:Read@28,file:Read@69 66eacb35174eb545872491665ef53c06c92a740c973a012825d67a3126abdfbc
+@legacy 8824c9d68ebeb9b9384d15e614f4ff38f64a868d15930943851cc5a2d2e71d0e internal/tsidentity/whois.go identity.Who legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-identity;basis=#486 A: the carlos-devbox service user, not root, queries tailscaled LocalAPI whois over the configured Unix socket (default /var/run/tailscale/tailscaled.sock) for the visitor remote address. New ReadAll reads at most 1 MiB plus one overflow byte from the HTTP response; redirects/errors and oversized or malformed JSON fail, and tagged devices or missing logins are anonymous. No ordinary file or deployment-record read; timeout/cancellation are bounded by the adapter and front door. R11 final fix wave: the enclosing cachedIdentity now caches provider timeouts and expired lookup contexts as anonymous failures for five seconds, discards late answers, and leaves explicit caller cancellation uncached; this adapter body and its reads are unchanged. file:ReadAll@748 faa815685cac4ee4cae548179dbd45e1e852bc5b1a9a13ab899d59ef0670747b
@legacy 39aaf4f9c6d9d4ab294be001cd688a16c1ae97c25edac77c85f41e5887c039c1 internal/devbox/registrar.go Registrar.serveShareFolder legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-mode;basis=new: the registrar (carlos-devbox user) reads the name from the query and the upload body (Content-Length required, capped at 200 MiB), scans it with scanSite (now also refusing a root _headers or _redirects over the edge's limit, final review fix) and reads its own registry row via claim. Caller identity is SO_PEERCRED only. Not root;rev3=census-ruling-devbox-identity;basis=#486 A: the carlos-devbox service user, not root, replaces req.URL.Query with strict url.ParseQuery(req.URL.RawQuery), refuses malformed query encoding, and validates repeated allow values before reading the capped upload body. Stores the normalized allow list in its local links.json and returns owner-filtered entry data. The scanner loses file:Query; existing archive, spool and local registry reads remain, with no new filesystem or deployment-record read. file:Read@1922,whole:Route@4070 dce50fcab6a2b64a712d58a6f236cdf19ec6264ce7bccba96116ab94c1a81d58
-@legacy e568dc4d9cbd7da9b7e0b990083abf5aa68eb8ecfa9c56e20badcdf4b3a68d39 internal/edge/edge.go Edge.Reload legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-design-edge-rate-limit-358;basis=each route's upstream entry gains rate: e.parseRateSettings(t), the row's rate_limit column parsed once per reload; the one added site is that whole:Route pass of t (parseRateSettings is a new unit, classified in the decisions overlay); no other read added;rev3=census-ruling-certwarm-wake;basis=the single reload hook call becomes runReloadHooks(), which runs every registered hook in order (#386); no read added, same 57 sites (56 before #358 landed on main);rev3=census-ruling-edge-asset-cache-3;basis=each tenant reverse proxy built in the switch (the tunnel, fleet, socket and TCP arms, every *httputil.ReverseProxy) is installed behind assetScrubbedProxy, which hands the proxy an assetInformationalScrub writer so an app's 1xx (103) loses the asset cache's reserved headers (X-Carlos-Asset-Fill, -Fill-Ack, -Expires, Carlos-Cache) on every local path, as the backhaul already does (final review F6); a type check of the proxy it just built and a wrapper around it; static and status handlers untouched; read sites unchanged (57), offsets moved; no read added;rev3=census-ruling-alias-wake-338;basis=#338 follow-up: after the path fold, a resolved platform alias takes its source's own upstream entry (same proxy, route, hibernating: the existing activator wake, lease and fence), keeping its own prefix map (none for a minted apex) and never inheriting the source's (Astra r2 P1); a refused alias, or one whose source has no entry, is dropped from the map (not served, not Allowed); the attached-hostname fold clears platformAlias;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 5: the activator-managed test (generation proxy, hib, no-activator 404) is Route.ActivatorOwned instead of Kind and Hibernate inline, so a resident rootfs instance goes through the activator; binary rows unchanged;rev3=census-ruling-edge-roll-blip;basis=the tcpProxy and multiProxy calls pass e.hold (the per-Edge localHold set once in newEdge): a loopback TCP upstream that refuses is redialled for up to 13 s and a probed route with a local upstream waits for prober readmission instead of answering 502/503 (#434 part B); edge-side dial policy only, no read added, same 52 sites;rev3=census-ruling-regional-domains-447;basis=#447 Task 5: after the alias fold, reads the regional_domains rows (e.reg.ListRegional; an error aborts the reload as every registry read here does) and applies them with foldRegional against the routes slice the same reload read; the added reads are that one registry list and the routes already read;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Tasks 4 and 6: the forward case (fleetProxy toward the binding's FleetBox, throttled refusal); one refusal check before the switch from FleetArmVerdict (sidecar not judged; a non-ready forward row refused; a forward row always judged by FleetServeEligible, any other row only where tunnels are on; an alias of a refused source refused with it); the accountless note; path rows of a forward host not folded; no alias folded onto a refused row; refusedHosts held through every fold. ListFleets and FleetChannelAuth read before the loop (+registry:FleetBox, +registry:Host x7, +whole:Route x3). Serving only; the hub's agent, not root. Review R1 finding 2: the switch reads verdict.Served (FleetArmVerdict) by host; the forward case and the fleet-placed case take their fleet from it (served.Fleet) instead of FleetPlacement(t.Region), and an admitted forward row not Served continues rather than falling through (+registry:Host, -registry:Region); the same rows take the same arms; no read added. Review R2: the switch is on DispatchArm(t, viaFleet, tunnels) (the order moved there unchanged: forward only when in Arm, own Tunnel, fleet, socket, addrs, static, status, else continue), the fleet cases read verdict.Arm (renamed from Served), and the platform-alias fold is foldPlatformAliases with the same take (source entry, own paths, alias marks) and the same refusal log (-registry:Kind x2, -registry:Socket, -registry:Tunnel, +whole:Route: those reads moved into DispatchArm); same rows, same arms, same entries; no read added.;rev3=census-ruling-fleet-routes-followups;basis=the owners map is now e.reg.FleetOwners() instead of ListFleets folded inline: the same fresh-connection ListFleets read and the same name->account map (-registry:Account, -registry:Name, -whole:Fleet x2 move into Registry.FleetOwners); no read added; same error path (abort the reload);rev3=census-ruling-tunnel-websockets;basis=The ArmTunnel arm now records its tenancy (Account, App, Tunnel) copied from the row t that Reload already lists; no new registry query, no file read. Also the reload mutex taken first and held to return, five nil-in-production test hooks, and the sweepUpgrades call after the swap, which reads only the map Reload has just built (spec 7, Tasks 3 and 4).;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 5, rule 3): the two fleet proxy builds pass the row to fleetBoxOf(t) instead of reading t.FleetBox (-registry:FleetBox x2, +whole:Route x2); fleetBoxOf answers FleetLabel as authoritative when set, else FleetBox; an authoritative box has no fallback to another of the fleet's channels (503 errFleetDark instead). The edge in the agent, not root; it routes to fewer channels, never more.;rev3=census-ruling-devbox-identity;basis=#486 A: only the devbox edge created by newDevboxEdge (carlos-devbox service user, not root) enables the new proxy hooks. Saves the existing DispatchArm result and reads t.Socket from an already-listed route when that arm is ArmSocket, passing it to configureDevboxProxy for per-request expected-owner validation and visitor-header rewriting. Adds one registry:Socket field site; no new registry query or file open, and ordinary fleet/agent edges leave the hook disabled. registry:Account@9457,registry:Alias@24401,registry:Alias@24488,registry:Alias@25068,registry:App@9473,registry:Health@13198,registry:Health@13324,registry:Host@10784,registry:Host@10841,registry:Host@10877,registry:Host@11620,registry:Host@13807,registry:Host@13902,registry:Host@14190,registry:Host@14216,registry:Host@14268,registry:Host@18863,registry:Host@20770,registry:Host@21078,registry:Host@21105,registry:Host@21920,registry:Host@22492,registry:Host@24822,registry:Host@24871,registry:Host@4701,registry:Host@4755,registry:Host@4805,registry:Host@5826,registry:Kind@17199,registry:Kind@17221,registry:Prefix@22467,registry:Socket@11684,registry:Socket@17078,registry:Socket@21086,registry:Status@4626,registry:Target@22479,registry:Tunnel@9317,registry:Tunnel@9488,registry:Version@17180,registry:Version@17282,whole:RegionalDomain@25710,whole:Route@10932,whole:Route@11040,whole:Route@11740,whole:Route@14341,whole:Route@14405,whole:Route@14456,whole:Route@21138,whole:Route@21145,whole:Route@21241,whole:Route@22355,whole:Route@23523,whole:Route@25702,whole:Route@294,whole:Route@3381,whole:Route@3439,whole:Route@5855,whole:Route@6744,whole:Route@6852,whole:Route@9379,whole:RouteAlias@24372,whole:RoutePath@21898 571d8e89d7c8e754b566c40946b0ee0965bf3925a71b07cde63f440bb33fda06
+@legacy 9b6559d1963d2f0274798e45174b480cf565f9351761c3e74b42d87e4c624825 internal/edge/edge.go Edge.Reload legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-design-edge-rate-limit-358;basis=each route's upstream entry gains rate: e.parseRateSettings(t), the row's rate_limit column parsed once per reload; the one added site is that whole:Route pass of t (parseRateSettings is a new unit, classified in the decisions overlay); no other read added;rev3=census-ruling-certwarm-wake;basis=the single reload hook call becomes runReloadHooks(), which runs every registered hook in order (#386); no read added, same 57 sites (56 before #358 landed on main);rev3=census-ruling-edge-asset-cache-3;basis=each tenant reverse proxy built in the switch (the tunnel, fleet, socket and TCP arms, every *httputil.ReverseProxy) is installed behind assetScrubbedProxy, which hands the proxy an assetInformationalScrub writer so an app's 1xx (103) loses the asset cache's reserved headers (X-Carlos-Asset-Fill, -Fill-Ack, -Expires, Carlos-Cache) on every local path, as the backhaul already does (final review F6); a type check of the proxy it just built and a wrapper around it; static and status handlers untouched; read sites unchanged (57), offsets moved; no read added;rev3=census-ruling-alias-wake-338;basis=#338 follow-up: after the path fold, a resolved platform alias takes its source's own upstream entry (same proxy, route, hibernating: the existing activator wake, lease and fence), keeping its own prefix map (none for a minted apex) and never inheriting the source's (Astra r2 P1); a refused alias, or one whose source has no entry, is dropped from the map (not served, not Allowed); the attached-hostname fold clears platformAlias;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 5: the activator-managed test (generation proxy, hib, no-activator 404) is Route.ActivatorOwned instead of Kind and Hibernate inline, so a resident rootfs instance goes through the activator; binary rows unchanged;rev3=census-ruling-edge-roll-blip;basis=the tcpProxy and multiProxy calls pass e.hold (the per-Edge localHold set once in newEdge): a loopback TCP upstream that refuses is redialled for up to 13 s and a probed route with a local upstream waits for prober readmission instead of answering 502/503 (#434 part B); edge-side dial policy only, no read added, same 52 sites;rev3=census-ruling-regional-domains-447;basis=#447 Task 5: after the alias fold, reads the regional_domains rows (e.reg.ListRegional; an error aborts the reload as every registry read here does) and applies them with foldRegional against the routes slice the same reload read; the added reads are that one registry list and the routes already read;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Tasks 4 and 6: the forward case (fleetProxy toward the binding's FleetBox, throttled refusal); one refusal check before the switch from FleetArmVerdict (sidecar not judged; a non-ready forward row refused; a forward row always judged by FleetServeEligible, any other row only where tunnels are on; an alias of a refused source refused with it); the accountless note; path rows of a forward host not folded; no alias folded onto a refused row; refusedHosts held through every fold. ListFleets and FleetChannelAuth read before the loop (+registry:FleetBox, +registry:Host x7, +whole:Route x3). Serving only; the hub's agent, not root. Review R1 finding 2: the switch reads verdict.Served (FleetArmVerdict) by host; the forward case and the fleet-placed case take their fleet from it (served.Fleet) instead of FleetPlacement(t.Region), and an admitted forward row not Served continues rather than falling through (+registry:Host, -registry:Region); the same rows take the same arms; no read added. Review R2: the switch is on DispatchArm(t, viaFleet, tunnels) (the order moved there unchanged: forward only when in Arm, own Tunnel, fleet, socket, addrs, static, status, else continue), the fleet cases read verdict.Arm (renamed from Served), and the platform-alias fold is foldPlatformAliases with the same take (source entry, own paths, alias marks) and the same refusal log (-registry:Kind x2, -registry:Socket, -registry:Tunnel, +whole:Route: those reads moved into DispatchArm); same rows, same arms, same entries; no read added.;rev3=census-ruling-fleet-routes-followups;basis=the owners map is now e.reg.FleetOwners() instead of ListFleets folded inline: the same fresh-connection ListFleets read and the same name->account map (-registry:Account, -registry:Name, -whole:Fleet x2 move into Registry.FleetOwners); no read added; same error path (abort the reload);rev3=census-ruling-tunnel-websockets;basis=The ArmTunnel arm now records its tenancy (Account, App, Tunnel) copied from the row t that Reload already lists; no new registry query, no file read. Also the reload mutex taken first and held to return, five nil-in-production test hooks, and the sweepUpgrades call after the swap, which reads only the map Reload has just built (spec 7, Tasks 3 and 4).;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 5, rule 3): the two fleet proxy builds pass the row to fleetBoxOf(t) instead of reading t.FleetBox (-registry:FleetBox x2, +whole:Route x2); fleetBoxOf answers FleetLabel as authoritative when set, else FleetBox; an authoritative box has no fallback to another of the fleet's channels (503 errFleetDark instead). The edge in the agent, not root; it routes to fewer channels, never more.;rev3=census-ruling-devbox-identity;basis=#486 A: only the devbox edge created by newDevboxEdge (carlos-devbox service user, not root) enables the new proxy hooks. Saves the existing DispatchArm result and reads t.Socket from an already-listed route when that arm is ArmSocket, passing it to configureDevboxProxy for per-request expected-owner validation and visitor-header rewriting. Adds one registry:Socket field site; no new registry query or file open, and ordinary fleet/agent edges leave the hook disabled. Final fix wave: its devbox-only outgoing-header/trailer hooks now also strip case-insensitive underscore/hyphen aliases through stripVisitorHeaders; no new read. registry:Account@9457,registry:Alias@24401,registry:Alias@24488,registry:Alias@25068,registry:App@9473,registry:Health@13198,registry:Health@13324,registry:Host@10784,registry:Host@10841,registry:Host@10877,registry:Host@11620,registry:Host@13807,registry:Host@13902,registry:Host@14190,registry:Host@14216,registry:Host@14268,registry:Host@18863,registry:Host@20770,registry:Host@21078,registry:Host@21105,registry:Host@21920,registry:Host@22492,registry:Host@24822,registry:Host@24871,registry:Host@4701,registry:Host@4755,registry:Host@4805,registry:Host@5826,registry:Kind@17199,registry:Kind@17221,registry:Prefix@22467,registry:Socket@11684,registry:Socket@17078,registry:Socket@21086,registry:Status@4626,registry:Target@22479,registry:Tunnel@9317,registry:Tunnel@9488,registry:Version@17180,registry:Version@17282,whole:RegionalDomain@25710,whole:Route@10932,whole:Route@11040,whole:Route@11740,whole:Route@14341,whole:Route@14405,whole:Route@14456,whole:Route@21138,whole:Route@21145,whole:Route@21241,whole:Route@22355,whole:Route@23523,whole:Route@25702,whole:Route@294,whole:Route@3381,whole:Route@3439,whole:Route@5855,whole:Route@6744,whole:Route@6852,whole:Route@9379,whole:RouteAlias@24372,whole:RoutePath@21898 571d8e89d7c8e754b566c40946b0ee0965bf3925a71b07cde63f440bb33fda06
devbox_cli.go runDevboxServe legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-mode;basis=new: carlos devbox serve, run by the carlos-devbox unit as the unprivileged carlos-devbox user, reads its config from the environment (CARLOS_DEVBOX_LISTEN, CARLOS_DEVBOX_DOMAIN, CARLOS_DATA_DIR, CARLOS_WILDCARD_DOMAINS, CARLOS_DEVBOX_SOCKET) and opens registry.db and links.json under its own StateDirectory. Not root;rev3=census-ruling-devbox-macos;basis=devbox on macOS (#488): serve now parses flags; --env-file PATH loads the service user's own env file (loadDevboxEnvFile) before reading the same environment as before; with CARLOS_DEVBOX_LAUNCHD_SOCKET set it takes launchd's listening socket (launchd.Listeners, macOS only; elsewhere it refuses) and holds it to CARLOS_DEVBOX_LISTEN (edge.CheckDevboxListener) before making anything; the socket path comes from devboxSocketPath (CARLOS_DEVBOX_SOCKET, or the OS default). Runs as the unprivileged service user (carlos-devbox on Linux, _carlos-devbox on macOS), never root; no new read beyond the env file named on its own command line;rev3=census-ruling-devbox-identity;basis=#486 A: carlos devbox serve runs as the carlos-devbox service user, not root. Adds configureDevboxIdentity before serving: reads CARLOS_DEVBOX_SOCKETS_DIR, CARLOS_DEVBOX_TAILSCALED_SOCKET and CARLOS_DEVBOX_SHARED_NODES, checks/creates the service-owned sockets directory, and wires the cached LocalAPI adapter plus allow/socket-owner lookups. Existing registry.db, links.json and optional env-file reads remain in the service account; no additional direct scanned read site in this unit. data-literal@1086,data-literal@776,file:Open@2328 adb0176fb0901ac32d80f16259b19d0f98c1978c3c28410bab3c6c0bafeaf0ab
infra/devbox/carlos-devbox.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-mode;basis=new: systemd unit for devbox mode on a developer workstation, installed once by hand per infra/devbox/README.md. Runs carlos devbox serve as User=carlos-devbox with only CAP_NET_BIND_SERVICE, NoNewPrivileges, ProtectSystem=strict and the hardening of carlos-edge.service; not installed by user_data or any CARLOS box path;rev3=census-ruling-devbox-identity;basis=#486 A: adds RuntimeDirectoryPreserve=yes so stopping the service preserves caller sockets under /run/carlos-devbox. ExecStart still runs carlos devbox serve with User=Group=carlos-devbox, never as root; only CAP_NET_BIND_SERVICE remains. No new executable or environment-file read; the existing systemd EnvironmentFile and hardening are unchanged. file:external@0 72440fc94179ddaa03203a6b897893b58a608c8ee878972908f97576e860aae8
internal/devbox/registrar.go Registrar.list legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-mode;basis=new: the registrar (carlos-devbox user) EvalSymlinks <spool>/<name>/current only to report whether a folder link resolves. Not root;rev3=census-ruling-devbox-identity;basis=#486 A: the carlos-devbox service user, not root, reads its in-memory links and passes the kernel-authenticated caller UID into entry so allow names are returned only to their owner. Adds bounded connect-and-close probes of stored socket paths without sending data; a replaced symlink can be followed by this availability probe. Existing folder-current EvalSymlinks and loopback probes remain; forwarding separately checks peer UID. file:EvalSymlinks@758 775ff5462af8d4afd4614a476d9f31f73ac6fa487d05a3b9b2656e7597dfa19a
@@ -25,12 +25,12 @@ devbox_cli.go prepareDevboxSocketsDir legacy accepted-legacy accepted-legacy;rev
internal/devbox/registrar.go Registrar.serveShareSocket legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-identity;basis=#486 A: the carlos-devbox service user, not root, decodes name/path/allow from the SO_PEERCRED-authenticated request, validates name/list, and calls checkSocket for direct-child path, inode owner/type and connected peer UID. Under its mutex it reads its local link/registry claim, persists a socket link in links.json and constructs the whole registry.Route passed to UpsertUnlessRootfs, with rollback on failure. No deployment bucket/record read; socket-path refusals return the configured directory as machine data. whole:Route@1231 b3389aa29c77785657375b60208aac3ac4a086baf9b2c24be4d7d6d98e12791c
internal/devbox/socketcheck_linux.go checkSocket legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-identity;basis=#486 A: the carlos-devbox service user, not root, validates the cleaned absolute socket path is directly inside its configured directory, opens with O_PATH|O_NOFOLLOW|O_CLOEXEC, and uses socketFstat to require a socket owned by the kernel-authenticated caller UID. Then a bounded connect and SO_PEERCRED lookup require the listening process to have that same UID. New reads are socket inode metadata and peer credentials, with no request payload sent and no file content read. file:Open@338 1eaaca6537d425a9bf1c6e507dc46d6814538676d022eac1fb79b331e5efa61b
internal/devbox/socketcheck_linux.go var#1 legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-identity;basis=#486 A: production assigns socketFstat=unix.Fstat and socketPeerUID=PeerUID as test seams for checkSocket. The carlos-devbox service user, not root, later uses these functions for the opened socket inode metadata and connected peer UID. The new file:Fstat site is a function value here; initialization itself performs no I/O. file:Fstat@23 aeebbb8ef221155002eec748d1269875edeceb1e199d85086bc6d1e829be6e91
-internal/edge/devboxfront.go devboxTrailerBody.Read legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-identity;basis=#486 A: the carlos-devbox service user, not root, reads the incoming HTTP request body through its wrapped ReadCloser. At EOF it strips all visitor identity trailer names before a handler can use late-populated trailers. The scanner counts Read identifiers as file reads; these are network request-body reads, not filesystem opens or root-owned data. file:Read@28,file:Read@69 66eacb35174eb545872491665ef53c06c92a740c973a012825d67a3126abdfbc
-internal/tsidentity/whois.go identity.Who legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-identity;basis=#486 A: the carlos-devbox service user, not root, queries tailscaled LocalAPI whois over the configured Unix socket (default /var/run/tailscale/tailscaled.sock) for the visitor remote address. New ReadAll reads at most 1 MiB plus one overflow byte from the HTTP response; redirects/errors and oversized or malformed JSON fail, and tagged devices or missing logins are anonymous. No ordinary file or deployment-record read; timeout/cancellation are bounded by the adapter and front door. file:ReadAll@748 faa815685cac4ee4cae548179dbd45e1e852bc5b1a9a13ab899d59ef0670747b
+internal/edge/devboxfront.go devboxTrailerBody.Read legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-identity;basis=#486 A: the carlos-devbox service user, not root, reads the incoming HTTP request body through its wrapped ReadCloser. At EOF it strips all visitor identity trailer names before a handler can use late-populated trailers. The scanner counts Read identifiers as file reads; these are network request-body reads, not filesystem opens or root-owned data. Final fix wave: the shared stripping helper now normalizes underscores to hyphens for comparisons, covering late EOF trailers as well as request and outgoing headers/trailers; this Read body and its reads are unchanged. file:Read@28,file:Read@69 66eacb35174eb545872491665ef53c06c92a740c973a012825d67a3126abdfbc
+internal/tsidentity/whois.go identity.Who legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-identity;basis=#486 A: the carlos-devbox service user, not root, queries tailscaled LocalAPI whois over the configured Unix socket (default /var/run/tailscale/tailscaled.sock) for the visitor remote address. New ReadAll reads at most 1 MiB plus one overflow byte from the HTTP response; redirects/errors and oversized or malformed JSON fail, and tagged devices or missing logins are anonymous. No ordinary file or deployment-record read; timeout/cancellation are bounded by the adapter and front door. R11 final fix wave: the enclosing cachedIdentity now caches provider timeouts and expired lookup contexts as anonymous failures for five seconds, discards late answers, and leaves explicit caller cancellation uncached; this adapter body and its reads are unchanged. file:ReadAll@748 faa815685cac4ee4cae548179dbd45e1e852bc5b1a9a13ab899d59ef0670747b
internal/devbox/registrar.go Registrar.serveShareFolder legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-mode;basis=new: the registrar (carlos-devbox user) reads the name from the query and the upload body (Content-Length required, capped at 200 MiB), scans it with scanSite (now also refusing a root _headers or _redirects over the edge's limit, final review fix) and reads its own registry row via claim. Caller identity is SO_PEERCRED only. Not root;rev3=census-ruling-devbox-identity;basis=#486 A: the carlos-devbox service user, not root, replaces req.URL.Query with strict url.ParseQuery(req.URL.RawQuery), refuses malformed query encoding, and validates repeated allow values before reading the capped upload body. Stores the normalized allow list in its local links.json and returns owner-filtered entry data. The scanner loses file:Query; existing archive, spool and local registry reads remain, with no new filesystem or deployment-record read. file:Read@1922,whole:Route@4070 dce50fcab6a2b64a712d58a6f236cdf19ec6264ce7bccba96116ab94c1a81d58
-internal/edge/edge.go Edge.Reload legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-design-edge-rate-limit-358;basis=each route's upstream entry gains rate: e.parseRateSettings(t), the row's rate_limit column parsed once per reload; the one added site is that whole:Route pass of t (parseRateSettings is a new unit, classified in the decisions overlay); no other read added;rev3=census-ruling-certwarm-wake;basis=the single reload hook call becomes runReloadHooks(), which runs every registered hook in order (#386); no read added, same 57 sites (56 before #358 landed on main);rev3=census-ruling-edge-asset-cache-3;basis=each tenant reverse proxy built in the switch (the tunnel, fleet, socket and TCP arms, every *httputil.ReverseProxy) is installed behind assetScrubbedProxy, which hands the proxy an assetInformationalScrub writer so an app's 1xx (103) loses the asset cache's reserved headers (X-Carlos-Asset-Fill, -Fill-Ack, -Expires, Carlos-Cache) on every local path, as the backhaul already does (final review F6); a type check of the proxy it just built and a wrapper around it; static and status handlers untouched; read sites unchanged (57), offsets moved; no read added;rev3=census-ruling-alias-wake-338;basis=#338 follow-up: after the path fold, a resolved platform alias takes its source's own upstream entry (same proxy, route, hibernating: the existing activator wake, lease and fence), keeping its own prefix map (none for a minted apex) and never inheriting the source's (Astra r2 P1); a refused alias, or one whose source has no entry, is dropped from the map (not served, not Allowed); the attached-hostname fold clears platformAlias;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 5: the activator-managed test (generation proxy, hib, no-activator 404) is Route.ActivatorOwned instead of Kind and Hibernate inline, so a resident rootfs instance goes through the activator; binary rows unchanged;rev3=census-ruling-edge-roll-blip;basis=the tcpProxy and multiProxy calls pass e.hold (the per-Edge localHold set once in newEdge): a loopback TCP upstream that refuses is redialled for up to 13 s and a probed route with a local upstream waits for prober readmission instead of answering 502/503 (#434 part B); edge-side dial policy only, no read added, same 52 sites;rev3=census-ruling-regional-domains-447;basis=#447 Task 5: after the alias fold, reads the regional_domains rows (e.reg.ListRegional; an error aborts the reload as every registry read here does) and applies them with foldRegional against the routes slice the same reload read; the added reads are that one registry list and the routes already read;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Tasks 4 and 6: the forward case (fleetProxy toward the binding's FleetBox, throttled refusal); one refusal check before the switch from FleetArmVerdict (sidecar not judged; a non-ready forward row refused; a forward row always judged by FleetServeEligible, any other row only where tunnels are on; an alias of a refused source refused with it); the accountless note; path rows of a forward host not folded; no alias folded onto a refused row; refusedHosts held through every fold. ListFleets and FleetChannelAuth read before the loop (+registry:FleetBox, +registry:Host x7, +whole:Route x3). Serving only; the hub's agent, not root. Review R1 finding 2: the switch reads verdict.Served (FleetArmVerdict) by host; the forward case and the fleet-placed case take their fleet from it (served.Fleet) instead of FleetPlacement(t.Region), and an admitted forward row not Served continues rather than falling through (+registry:Host, -registry:Region); the same rows take the same arms; no read added. Review R2: the switch is on DispatchArm(t, viaFleet, tunnels) (the order moved there unchanged: forward only when in Arm, own Tunnel, fleet, socket, addrs, static, status, else continue), the fleet cases read verdict.Arm (renamed from Served), and the platform-alias fold is foldPlatformAliases with the same take (source entry, own paths, alias marks) and the same refusal log (-registry:Kind x2, -registry:Socket, -registry:Tunnel, +whole:Route: those reads moved into DispatchArm); same rows, same arms, same entries; no read added.;rev3=census-ruling-fleet-routes-followups;basis=the owners map is now e.reg.FleetOwners() instead of ListFleets folded inline: the same fresh-connection ListFleets read and the same name->account map (-registry:Account, -registry:Name, -whole:Fleet x2 move into Registry.FleetOwners); no read added; same error path (abort the reload);rev3=census-ruling-tunnel-websockets;basis=The ArmTunnel arm now records its tenancy (Account, App, Tunnel) copied from the row t that Reload already lists; no new registry query, no file read. Also the reload mutex taken first and held to return, five nil-in-production test hooks, and the sweepUpgrades call after the swap, which reads only the map Reload has just built (spec 7, Tasks 3 and 4).;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 5, rule 3): the two fleet proxy builds pass the row to fleetBoxOf(t) instead of reading t.FleetBox (-registry:FleetBox x2, +whole:Route x2); fleetBoxOf answers FleetLabel as authoritative when set, else FleetBox; an authoritative box has no fallback to another of the fleet's channels (503 errFleetDark instead). The edge in the agent, not root; it routes to fewer channels, never more.;rev3=census-ruling-devbox-identity;basis=#486 A: only the devbox edge created by newDevboxEdge (carlos-devbox service user, not root) enables the new proxy hooks. Saves the existing DispatchArm result and reads t.Socket from an already-listed route when that arm is ArmSocket, passing it to configureDevboxProxy for per-request expected-owner validation and visitor-header rewriting. Adds one registry:Socket field site; no new registry query or file open, and ordinary fleet/agent edges leave the hook disabled. registry:Account@9457,registry:Alias@24401,registry:Alias@24488,registry:Alias@25068,registry:App@9473,registry:Health@13198,registry:Health@13324,registry:Host@10784,registry:Host@10841,registry:Host@10877,registry:Host@11620,registry:Host@13807,registry:Host@13902,registry:Host@14190,registry:Host@14216,registry:Host@14268,registry:Host@18863,registry:Host@20770,registry:Host@21078,registry:Host@21105,registry:Host@21920,registry:Host@22492,registry:Host@24822,registry:Host@24871,registry:Host@4701,registry:Host@4755,registry:Host@4805,registry:Host@5826,registry:Kind@17199,registry:Kind@17221,registry:Prefix@22467,registry:Socket@11684,registry:Socket@17078,registry:Socket@21086,registry:Status@4626,registry:Target@22479,registry:Tunnel@9317,registry:Tunnel@9488,registry:Version@17180,registry:Version@17282,whole:RegionalDomain@25710,whole:Route@10932,whole:Route@11040,whole:Route@11740,whole:Route@14341,whole:Route@14405,whole:Route@14456,whole:Route@21138,whole:Route@21145,whole:Route@21241,whole:Route@22355,whole:Route@23523,whole:Route@25702,whole:Route@294,whole:Route@3381,whole:Route@3439,whole:Route@5855,whole:Route@6744,whole:Route@6852,whole:Route@9379,whole:RouteAlias@24372,whole:RoutePath@21898 571d8e89d7c8e754b566c40946b0ee0965bf3925a71b07cde63f440bb33fda06
+internal/edge/edge.go Edge.Reload legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-design-edge-rate-limit-358;basis=each route's upstream entry gains rate: e.parseRateSettings(t), the row's rate_limit column parsed once per reload; the one added site is that whole:Route pass of t (parseRateSettings is a new unit, classified in the decisions overlay); no other read added;rev3=census-ruling-certwarm-wake;basis=the single reload hook call becomes runReloadHooks(), which runs every registered hook in order (#386); no read added, same 57 sites (56 before #358 landed on main);rev3=census-ruling-edge-asset-cache-3;basis=each tenant reverse proxy built in the switch (the tunnel, fleet, socket and TCP arms, every *httputil.ReverseProxy) is installed behind assetScrubbedProxy, which hands the proxy an assetInformationalScrub writer so an app's 1xx (103) loses the asset cache's reserved headers (X-Carlos-Asset-Fill, -Fill-Ack, -Expires, Carlos-Cache) on every local path, as the backhaul already does (final review F6); a type check of the proxy it just built and a wrapper around it; static and status handlers untouched; read sites unchanged (57), offsets moved; no read added;rev3=census-ruling-alias-wake-338;basis=#338 follow-up: after the path fold, a resolved platform alias takes its source's own upstream entry (same proxy, route, hibernating: the existing activator wake, lease and fence), keeping its own prefix map (none for a minted apex) and never inheriting the source's (Astra r2 P1); a refused alias, or one whose source has no entry, is dropped from the map (not served, not Allowed); the attached-hostname fold clears platformAlias;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 5: the activator-managed test (generation proxy, hib, no-activator 404) is Route.ActivatorOwned instead of Kind and Hibernate inline, so a resident rootfs instance goes through the activator; binary rows unchanged;rev3=census-ruling-edge-roll-blip;basis=the tcpProxy and multiProxy calls pass e.hold (the per-Edge localHold set once in newEdge): a loopback TCP upstream that refuses is redialled for up to 13 s and a probed route with a local upstream waits for prober readmission instead of answering 502/503 (#434 part B); edge-side dial policy only, no read added, same 52 sites;rev3=census-ruling-regional-domains-447;basis=#447 Task 5: after the alias fold, reads the regional_domains rows (e.reg.ListRegional; an error aborts the reload as every registry read here does) and applies them with foldRegional against the routes slice the same reload read; the added reads are that one registry list and the routes already read;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Tasks 4 and 6: the forward case (fleetProxy toward the binding's FleetBox, throttled refusal); one refusal check before the switch from FleetArmVerdict (sidecar not judged; a non-ready forward row refused; a forward row always judged by FleetServeEligible, any other row only where tunnels are on; an alias of a refused source refused with it); the accountless note; path rows of a forward host not folded; no alias folded onto a refused row; refusedHosts held through every fold. ListFleets and FleetChannelAuth read before the loop (+registry:FleetBox, +registry:Host x7, +whole:Route x3). Serving only; the hub's agent, not root. Review R1 finding 2: the switch reads verdict.Served (FleetArmVerdict) by host; the forward case and the fleet-placed case take their fleet from it (served.Fleet) instead of FleetPlacement(t.Region), and an admitted forward row not Served continues rather than falling through (+registry:Host, -registry:Region); the same rows take the same arms; no read added. Review R2: the switch is on DispatchArm(t, viaFleet, tunnels) (the order moved there unchanged: forward only when in Arm, own Tunnel, fleet, socket, addrs, static, status, else continue), the fleet cases read verdict.Arm (renamed from Served), and the platform-alias fold is foldPlatformAliases with the same take (source entry, own paths, alias marks) and the same refusal log (-registry:Kind x2, -registry:Socket, -registry:Tunnel, +whole:Route: those reads moved into DispatchArm); same rows, same arms, same entries; no read added.;rev3=census-ruling-fleet-routes-followups;basis=the owners map is now e.reg.FleetOwners() instead of ListFleets folded inline: the same fresh-connection ListFleets read and the same name->account map (-registry:Account, -registry:Name, -whole:Fleet x2 move into Registry.FleetOwners); no read added; same error path (abort the reload);rev3=census-ruling-tunnel-websockets;basis=The ArmTunnel arm now records its tenancy (Account, App, Tunnel) copied from the row t that Reload already lists; no new registry query, no file read. Also the reload mutex taken first and held to return, five nil-in-production test hooks, and the sweepUpgrades call after the swap, which reads only the map Reload has just built (spec 7, Tasks 3 and 4).;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 5, rule 3): the two fleet proxy builds pass the row to fleetBoxOf(t) instead of reading t.FleetBox (-registry:FleetBox x2, +whole:Route x2); fleetBoxOf answers FleetLabel as authoritative when set, else FleetBox; an authoritative box has no fallback to another of the fleet's channels (503 errFleetDark instead). The edge in the agent, not root; it routes to fewer channels, never more.;rev3=census-ruling-devbox-identity;basis=#486 A: only the devbox edge created by newDevboxEdge (carlos-devbox service user, not root) enables the new proxy hooks. Saves the existing DispatchArm result and reads t.Socket from an already-listed route when that arm is ArmSocket, passing it to configureDevboxProxy for per-request expected-owner validation and visitor-header rewriting. Adds one registry:Socket field site; no new registry query or file open, and ordinary fleet/agent edges leave the hook disabled. Final fix wave: its devbox-only outgoing-header/trailer hooks now also strip case-insensitive underscore/hyphen aliases through stripVisitorHeaders; no new read. registry:Account@9457,registry:Alias@24401,registry:Alias@24488,registry:Alias@25068,registry:App@9473,registry:Health@13198,registry:Health@13324,registry:Host@10784,registry:Host@10841,registry:Host@10877,registry:Host@11620,registry:Host@13807,registry:Host@13902,registry:Host@14190,registry:Host@14216,registry:Host@14268,registry:Host@18863,registry:Host@20770,registry:Host@21078,registry:Host@21105,registry:Host@21920,registry:Host@22492,registry:Host@24822,registry:Host@24871,registry:Host@4701,registry:Host@4755,registry:Host@4805,registry:Host@5826,registry:Kind@17199,registry:Kind@17221,registry:Prefix@22467,registry:Socket@11684,registry:Socket@17078,registry:Socket@21086,registry:Status@4626,registry:Target@22479,registry:Tunnel@9317,registry:Tunnel@9488,registry:Version@17180,registry:Version@17282,whole:RegionalDomain@25710,whole:Route@10932,whole:Route@11040,whole:Route@11740,whole:Route@14341,whole:Route@14405,whole:Route@14456,whole:Route@21138,whole:Route@21145,whole:Route@21241,whole:Route@22355,whole:Route@23523,whole:Route@25702,whole:Route@294,whole:Route@3381,whole:Route@3439,whole:Route@5855,whole:Route@6744,whole:Route@6852,whole:Route@9379,whole:RouteAlias@24372,whole:RoutePath@21898 571d8e89d7c8e754b566c40946b0ee0965bf3925a71b07cde63f440bb33fda06
@coverage . 2a0d672e4d101f46913c016237303a5b5f15226a3c018bb8e0b388179df9ac9c
@coverage infra/devbox a4d597f456ba1a8e0bbc0671e249eed6afd457ac206d84c724809b54051b8e10
@coverage internal/devbox 42f6830904ebc3c1ffad34df93de727aaf64de4f548d33444e9a81b6596a8cc6
-@coverage internal/edge 37736cc96ea2968c050ea02a97b36dfb3c54d0151217785c29c2ac70804dffbc
+@coverage internal/edge 40295427c7c0364fbc750ba1fd03210f29614452f6f22a4af9f00b6e3d2c84d8
@coverage internal/tsidentity 580665b5051ea5ce8cd092d848d813ca1c24af424e2342b7b47f4ade4a21873e