carlos / platform Public

review: Astra brief for #1348, round 1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 69f84d5cd0fcc609fa5aca213e36e01a69248c2e parent 387a5e3
1 file changed, +78 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-fleet-client-address-1348.md +78 −0

CI cancelled — superseded by a newer push — run details

CI log
=== gate ===
go: downloading go1.26.10 (linux/arm64)
go version go1.26.10 linux/arm64
opentofu: arm64, tofu 1.13.9, aws 6.73.0, archive 2.8.1
  tofu: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/tofu_1.13.9_linux_arm64.tar.gz
  tofu: downloaded, digest verified
  aws: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/terraform-provider-aws_6.73.0_linux_arm64.zip
  aws: downloaded, digest verified
  archive: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/terraform-provider-archive_2.8.1_linux_arm64.zip
  archive: downloaded, digest verified
  installed in /tmp/carlos-opentofu-RZzFBM
.amadan/test-gate.sh
go: downloading github.com/aws/aws-sdk-go-v2 v1.44.0
go: downloading github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.68.0
go: downloading github.com/aws/aws-sdk-go-v2/service/costexplorer v1.67.5
go: downloading github.com/aws/aws-sdk-go-v2/service/s3 v1.105.0
go: downloading github.com/aws/smithy-go v1.28.1
go: downloading github.com/benbjohnson/litestream v0.5.14
go: downloading github.com/superfly/ltx v0.5.1
go: downloading golang.org/x/net v0.62.0
go: downloading modernc.org/sqlite v1.55.0
go: downloading github.com/aws/aws-sdk-go-v2/config v1.32.6
go: downloading github.com/aws/aws-sdk-go-v2/service/acm v1.45.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ec2 v1.324.0
go: downloading github.com/aws/aws-sdk-go-v2/service/iam v1.58.2
go: downloading github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.37.0
go: downloading github.com/aws/aws-sdk-go-v2/service/route53 v1.64.1
go: downloading golang.org/x/sys v0.49.0
go: downloading github.com/aws/aws-sdk-go-v2/service/sns v1.43.0
go: downloading golang.org/x/crypto v0.58.0
go: downloading github.com/oschwald/maxminddb-golang v1.13.1
go: downloading github.com/pion/logging v0.2.4
go: downloading github.com/pion/stun/v3 v3.1.5
go: downloading github.com/pion/turn/v4 v4.1.4
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/pion/randutil v0.1.0
go: downloading github.com/pion/transport/v4 v4.0.2
go: downloading github.com/pion/dtls/v3 v3.1.4
go: downloading github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.18
go: downloading golang.org/x/sync v0.24.0
go: downloading github.com/prometheus/client_golang v1.17.0
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/wlynxg/anet v0.0.5
go: downloading google.golang.org/protobuf v1.36.10
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash/v2 v2.3.0
go: downloading github.com/prometheus/common v0.45.0
go: downloading github.com/prometheus/procfs v0.12.0
go: downloading github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0
go: downloading golang.org/x/text v0.43.0
go: downloading modernc.org/sqlite v1.55.0
go: downloading golang.org/x/crypto/x509roots/fallback v0.0.0-20260209214922-2f26647a795e
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/aws/aws-sdk-go-v2/service/ecs v1.91.0
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading modernc.org/libc v1.74.1
go: downloading modernc.org/libc v1.74.1
go: downloading modernc.org/memory v1.11.0
go: downloading github.com/google/uuid v1.6.0
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading modernc.org/mathutil v1.7.1
go: downloading modernc.org/mathutil v1.7.1
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading modernc.org/memory v1.11.0
go: downloading github.com/google/uuid v1.6.0

amadan: job cancelled — a newer push superseded it
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-fleet-client-address-1348.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-fleet-client-address-1348.md
new file mode 100644
index 000000000..e353a8735
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-fleet-client-address-1348.md
@@ -0,0 +1,78 @@
+# Review brief: branch fleet-client-address-1348 (#1348), round 1 of 3
+
+Repo carlos/platform, branch `fleet-client-address-1348`, commit 387a5e379d2f82a45fc5259b13e24181379a189f.
+Under review: the diff `origin/main...fleet-client-address-1348` (base d3266e8e).
+Authorities: amadan discussion #1348 (the ask and the design note posted there), #476 (the earlier
+trust sketch), and the linked deployments behaviour already on main (internal/edge/edge.go
+ServeLinked, docs/site/linked-deployments.md).
+
+You are an independent reviewer. Read the diff, then the code it touches and the code around it,
+and check every claim against that code.
+
+## The change
+
+Fleet and -tunnel apps behind a hub saw the hub's address as the client. The box's edge, for a
+request that arrived over a tunnel it dialled (tunnelclient's context mark), now passes the hub's
+X-Forwarded-For chain to the app when every entry is an IP (hubVisitor, formerly linkVisitor), and
+keys the password gate's attempt limiter on the chain's last entry. Off a tunnel nothing changes.
+Docs: docs/site/rootfs.md "The visitor's address", docs/site/rails.md pointer.
+
+## Fixed: do not re-argue
+
+- Trust rule (#476, #1348 design note): a request on a tunnel this box dialled to its configured
+ hub is the hub's; on a plaintext tunnel URL an on-path attacker can already inject any request
+ (geoip spec D2 makes the same call for geo headers).
+- Scope: the box only; the hub is unchanged. The platform's own analytics, rate limit, guard and
+ request records skip tunnelled requests on the box and stay that way.
+
+## What to check
+
+1. Trust boundary: can a request reach the box edge's setForwarded or the new gate-key code with
+ fromTunnel true but an X-Forwarded-For the hub did not write? Check every hub-to-channel sender
+ (tunnelRewrite users, linkProxy, replica proxy/replicaRoundTrip, the replica prober, upgrades via
+ roundTripUpgrade, the -tunnel login pass-through) and anything on the box that serves tunnelled
+ requests outside ServeHTTP's normal path. Could a client-sent XFF survive into a hub's outbound
+ tunnel request on any path?
+2. Hub chain correctness: does the hub's outbound chain always end with the client it saw (PPv2
+ listener, hairpin, verified hop, door call, devbox front)? Any case where the box now shows the
+ app an address that is worse than the hub's address (e.g. a platform-internal address)?
+3. Box onward paths: a tunnelled request the box then backhauls to a sibling (mesh hop), proxies via
+ the activator, serves via genproxy/multiProxy, or that is a linked request (pinned) - is the chain
+ right in each, and is the forwarded-for proof (signForwarded) still signing what is sent?
+4. setForwarded ordering: link pin, door, tunnel, hop. Any case where a request is both tunnelled
+ and a verified hop or door call, and the new branch changes the answer wrongly?
+5. The gate key in ServeHTTP: placed after acceptHop; is any gate attempt reachable earlier, or does
+ a linked request get keyed twice differently?
+6. Tests: internal/edge/tunnel_client_addr_test.go - do they prove the end-to-end property (real
+ tunnelclient loop, hub edge, box edge) and the fallbacks? The fromTunnel override is a package
+ var; is the test safe under the package's parallelism?
+7. Docs accuracy (rootfs.md, rails.md): "the last entry is always the address the platform saw",
+ "This also holds on a fleet box". True on every path to a rootfs app's web process? Rails
+ request.remote_ip / Rack::Request#ip claims were checked against Puma 8 / actionpack 8.1 / rack
+ 3.2 source: rightmost non-trusted entry; REMOTE_ADDR on a unix socket is blank or loopback.
+8. Census: docs/superpowers/notes/census-proposal-fleet-client-address-1348.md. Give a verdict for
+ the Edge.ServeHTTP unit and for the internal/edge and internal/gate envelopes: reject if root now
+ opens, runs, queries or follows anything new from a path or input a tenant, app or box agent can
+ create, write or name, or if a check the basis relies on is weakened.
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work. Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review.
+- **P3**: clarity or polish. Follow-up list; never a reason for another round.
+
+A P1 states its failure scenario and the evidence (file:line). Do not raise a P2 to P1 to keep the
+review open.
+
+## Output
+
+Findings ranked P1, P2, P3. Each gives the area, the problem, the evidence (file:line, verified),
+the failure scenario, a concrete fix and the invariant or trust boundary it breaks. Then the census
+verdicts (approve/reject per unit and envelope). End with exactly one verdict:
+
+- **READY**: no P1 and no P2.
+- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another round.
+- **NOT READY**: one or more P1s, listed.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of your own. Do not run the
+full test suites; targeted `go test ./internal/edge/ -run <pattern>` is fine (leave GOCACHE unset).