diff --git a/README.md b/README.md index 7fbba30..d7f0aef 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ separate, explicitly armed switch. ## Build ```sh -make # apex-twin, ~210 kB static-ish binary, zero warnings under -Werror -make test # 185 end-to-end checks, no mocks +make # apex-twin, ~220 kB static-ish binary, zero warnings under -Werror +make test # 197 end-to-end checks, no mocks make install # /usr/local/bin/apex-twin ``` @@ -131,6 +131,22 @@ took the first number in `HTTP/1.1 200 OK`, which is the `1` of the version, so path discovery and both probes had been comparing status `1` for every answer. The status is now parsed after the protocol token, and the test asserts `200`. +## The proxy + +`apex-twin --proxy 8798` is the same gate in front of a client that is not +MCP-aware: point `curl -x http://127.0.0.1:8798` (or a browser) at it and every +request is checked with the scope before a socket opens, with the decision in +`audit.log`. Plain HTTP is forwarded, the absolute request line is rewritten to +origin form, and the exchange is stored through the same `traffic/` store as +`http_capture`. `CONNECT` is tunnelled blind — this binary links no TLS stack, +so the proxy records host, port and byte counts rather than pretending to see +inside TLS. A request outside the scope gets `403 Forbidden` with the gate's +reason in the body. + +It serves one connection at a time. That is a deliberate trade: serial handling +keeps the gate order obvious and an origin that stalls costs one timeout, not the +process. + ## Tools (40) **Scope and bookkeeping** — `scope_show`, `scope_check` (ask the gate without @@ -175,13 +191,15 @@ plus a note per tool on what people get wrong with it. ```sh apex-twin # MCP over stdin/stdout (one JSON-RPC line each way) apex-twin --http 8797 # MCP over HTTP on 127.0.0.1:8797, POST /mcp +apex-twin --proxy 8798 # forward proxy on 127.0.0.1:8798 (curl -x) apex-twin --check # scope, tool count and state dir as JSON, then exit ``` -HTTP binds **loopback only**. A service that can scan and transmit must not appear -on a LAN by accident; reach it through a tunnel. `systemd/apex-twin.service` runs -exactly that: `--http 127.0.0.1:8797`, a 0700 state dir, `dialout` for the radio, -and a capability bounding set without `CAP_NET_RAW` (connect scans need none). +HTTP and the proxy bind **loopback only**. A service that can scan and transmit +must not appear on a LAN by accident; reach it through a tunnel. +`systemd/apex-twin.service` and `systemd/apex-twin-proxy.service` run exactly +that: loopback ports, a 0700 state dir, `dialout` for the radio, and a capability +bounding set without `CAP_NET_RAW` (connect scans need none). ## The radio @@ -236,7 +254,7 @@ finding and the next report no longer mentions it. make test ``` -185 checks, real binary, real DNS, real files written; no mocks. The suite was +197 checks, real binary, real DNS, real files written; no mocks. The suite was seen red on purpose: with the "no scope" branch disabled by `if (0 && ...)`, three checks fail, because they assert the *reason* and not merely that an error came back — a gate that falls through to the next deny branch looks identical @@ -250,7 +268,9 @@ unfiltered set. Disabling the asset merge turned seven red, and while it was red it exposed a real bug: the create path read an uninitialised struct, so a fresh asset's port list was built on stack garbage. A `memset` fixed it; the sabotage that found it is in the history of the suite. With the old `status_code()` back, -the capture reported status `1` instead of `200` and two checks went red. +the capture reported status `1` instead of `200` and two checks went red. With +the proxy's gate call bypassed, the out-of-scope request was forwarded and three +checks went red (403 became 502, and the audit had no deny). A port is never assumed: an earlier version of the HTTP test used 18797, which on this host is an SSH forward to another machine, and a foreign server answered @@ -258,10 +278,11 @@ this host is an SSH forward to another machine, and a foreign server answered ## Status -0.6.0. Built and run: 40 tools, 185 checks. The loop closes: a probe captures +0.7.0. Built and run: 40 tools, 197 checks. The loop closes: a probe captures the exchange as a pair, a finding points at it, `finding_update` gives it a state, an asset records the host it came from, `report_markdown` turns findings and inventory into one Markdown or CSV file, and `evidence_read`/`traffic_read` -get the proof back. Not yet wired into a fleet router. +get the proof back. `--proxy` puts the same gate in front of curl and a browser. +Not yet wired into a fleet router. Licence: AGPL-3.0, same as ARTEX. diff --git a/docs/artex-port.md b/docs/artex-port.md index 5974513..e6da06f 100644 --- a/docs/artex-port.md +++ b/docs/artex-port.md @@ -20,7 +20,8 @@ module, deliberately left out, or still open. | Finding lifecycle (`finding_workflow.go`, `finding_verification.go`) | `finding_update`, report status filter | open/confirmed/false-positive/fixed plus a note; no retest runner | | Evidence (`evidence/store.go`) | `evidence/-