Transfer-Encoding: chunked is no longer 501. The proxy reads the chunk framing (hex size with extensions, data, CRLF, trailers), validates it, and relays it unchanged so the origin still receives chunked encoding: - payload cap 1 MiB, checked from the chunk size before reading the data, so a declared gigabyte costs one line; over the cap -> 413. - malformed size or framing -> 400. Both answers happen before the origin socket is opened, so a broken body never becomes half a request to someone else. - the raw capture keeps the chunk framing (Transfer-Encoding header, size lines, data, trailers), so traffic_read shows what was actually sent. - Content-Length is dropped when chunked is present (TE wins); the old 501 branch and its comment are gone. Tests use a local origin that decodes chunked: 5+6 bytes become 'hello world', a body split across two writes works, 0x200000 answers 413, 'ZZ' answers 400, and the traffic record contains the framing. Red proof: forcing r->chunked = 0 turned seven checks red. 276 checks, coverage 74.1% (make coverage re-run).
4.0 KiB
4.0 KiB
ARTEX → APEX TWIN: what was ported and what was not
ARTEX (~/src/ARTEX) is a Go platform: an LLM-driven pentest engine with an
agent loop, a Postgres store, a web UI, a traffic archive, an intercepting proxy
and a command guard. APEX TWIN takes the ideas that hold up without a database
and without a model in the serving path, and writes them in C99/POSIX with one
binary and libc.
This page keeps the port honest: every ARTEX subsystem is either mapped to a C module, deliberately left out, or still open.
Ported
| ARTEX | APEX TWIN | Notes |
|---|---|---|
RoE / target scope (intercept, server/target_gate*) |
src/scope.c |
Ordered rules, deny-beats-allow, DNS-rebinding rule, expiry, allow_private, serial_tx |
Guard audit trail (guard/guard.go audit ring) |
src/store.c apex_audit() |
Append-only JSON line written before the action |
Command guard (guard/guard.go deny rules) |
src/guard.c, guard_check |
Deny rules first, then the scope of every target in the line; no execution |
Findings (server/findings*.go, db) |
src/store.c findings + finding_* |
One JSON file per finding, status lifecycle, atomic update |
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/<ts>-<label>.bin + evidence_save/_list/_read |
0600 blobs, base64 on read when not text |
Asset inventory (server/assets*.go) |
src/store.c assets + asset_* |
One file per target, merged by target, gated on add |
Traffic archive (traffic/) |
src/store.c traffic + http_capture/traffic_* |
Request/response pair on disk; a capture is a proof |
Notifications (notify/) |
src/notify.c, notify_test |
Webhook via curl, severity floor, fire-and-forget, audited; not gated (operator infrastructure) |
Intercepting proxy (intercept/, traffic/proxy.go) |
src/proxy.c, --proxy |
Loopback forward proxy, gate before connect, HTTP captured (Content-Length and chunked bodies), CONNECT tunnelled blind; no TLS interception |
Request rewriting (traffic/rewrite, intercept) |
src/rewrite.c, rewrite.json |
Ordered host/path rules: set/remove headers or block, first match, SIGHUP reload, rule named in traffic and audit; scope still first |
Report export (report/findings.go) |
tools_report.c report_markdown |
Markdown and CSV, severity-sorted, severity and lifecycle tables, optional asset table |
Budgets / timeouts (agent/budget.go) |
APEX_DEFAULT_TIMEOUT_MS, APEX_MAX_TIMEOUT_MS |
Per-tool timeout, process-group kill |
Skills / methodology (skills/) |
src/tools_kb.c |
12 techniques + per-tool pitfalls as data tables |
Wireless recon (agent/tools*, Marauder) |
src/tools_radio.c |
Serial CLI, console guard, allowlist, tx second gate |
Deliberately not ported
| ARTEX | Why not |
|---|---|
Agent engine, planner, intents, goals (agent/) |
The MCP client is the agent; a second scheduler in C would duplicate its loop and need an LLM client |
Postgres store (db/) |
Files under $APEX_HOME are the whole state; a report is a directory listing |
Web UI (web/) |
No HTTP UI in the binary; the MCP client is the UI |
Multi-user auth, sessions, chat (server/auth*.go) |
One operator, one process, loopback transport |
LLM pool and providers (llmpool/, agent/provider*.go) |
No model in the serving path by design |
Traffic archive and intercepting proxy (traffic/, intercept/) |
The largest open item; see below |
| Intercept rules in the database | A scope file an operator can read is the C version of the same idea |
Open
- TLS interception: deliberately absent; CONNECT is a blind tunnel.
- Agent engine, planner, LLM pool: deliberately absent; the MCP client is the agent and the serving path stays deterministic.
The rule for every item: it may observe or prove, it may not add a shell, and it
must call gated()/apex_scope_check() before it opens a socket or spawns a
process.