14 Commits
Author SHA1 Message Date
lotherk 32ece44c58 apex-twin 1.0.4: detailed README, CNCL license, scope edge tests
- README rewritten for a first-time reader: the gate and its rule order, quick
  start, all 45 tools by group, transports, proxy and rewrite rules, findings/
  assets/traffic/reports, state layout, security model, limits, build and
  release targets, install layout, environment, source layout, 1.x promise.
- License changed to CNCL 1.1 (Could Not Care Less License). LICENSE carries the
  unchanged text; README, SECURITY.md and the man page point at it. make dist and
  make install ship LICENSE.
- Scope gap tests: deny_ip beats allow_ip, port range endpoints and neighbours,
  /25 boundary, IPv6 CIDR accept/refuse, apex vs subdomain vs wildcard matching
  (*.name not matching the apex), embedded host:port, trailing FQDN dot, and a
  failed scope_reload closing the gate. scope.c 75.9% -> 82.8%, total 79.4%.

397 checks, analyze clean, release-check green including distcheck 1.0.4.
2026-11-21 10:42:27 +00:00
lotherk fa8f258fb9 apex-twin 1.0.1: check that the five version places agree
APEX_VERSION in src/apex.h is the only source of truth, and nothing compared it
with what users read. SECURITY.md claimed 0.23.x while the tree was at 0.30.0 for
seven releases.

tests/version_check.py now checks five places and names each disagreement:
man page .TH, README status line, top CHANGELOG heading, SECURITY supported line
(<major>.<minor>.x) and the Makefile tarball name (which must derive from
APEX_VERSION, not hardcode it). It runs first in tests/run.sh, has its own
make version-check target, and is the first step of make release-check.

Bump 1.0.0 -> 1.0.1 with all five updated. Red proof: leaving the man page at
1.0.0 fails with 'docs/apex-twin.1 .TH says 1.0.0, header says 1.0.1' and run.sh
stops before the suite.

Verified: make test (version check + gate audit + 334 checks), make analyze 0,
make release-check green through distcheck 1.0.1.
2026-11-21 09:56:45 +00:00
lotherk b4af387333 apex-twin 0.30.0: install the doc set and a man page
make install now ships five documents into $PREFIX/share/doc/apex-twin/
(README, CHANGELOG, SECURITY, operations, artex-port) and a new apex-twin(1)
man page into $PREFIX/share/man/man1/. MANDIR is overridable like the other
directories; DESTDIR works as before.

docs/apex-twin.1 covers the five modes, the scope rule order, every environment
variable (state, scope, rewrite, serial, dry-run, timeouts, webhook, proxy and
HTTP caps, audit and evidence limits), the state files, examples for --check and
curl -x, the hard limits, and pointers to the longer docs. mandoc -T lint is
clean and groff renders it.

Verified: make install DESTDIR=/tmp/apex-install-test lists the four units/docs
plus man page with modes 644/755; make test 334/334; release-check green
including distcheck 0.30.0.
2026-11-21 09:43:07 +00:00
lotherk 17a7a97b46 apex-twin 0.23.0: changelog, supported-version fix, dist carries both
CHANGELOG.md records every released increment from 0.1.0 to 0.23.0 with the
commit that introduced it and the reason for it: the gate, the guard, findings
and assets, traffic and the proxy, rewriting, webhook, web checks, the fuzzers,
coverage, the PTY radio simulator and the release gate. The current entry is
this commit; earlier hashes are from git log.

SECURITY.md no longer claims 0.19.x forever: the supported line is the one
apex-twin --version prints, with the current line named and a note that older
builds are rebuilt rather than patched and that state stays readable.

make dist now ships CHANGELOG.md next to README and SECURITY. README links it.

tests/run.py prints rc and stderr when a run produces no stdout; one
release-check run hit that once (before this diagnostic), the following run and
three parallel suite runs were clean. Kept strict: empty output is a failure,
not a retry.

Verified: make test 298/298 + gate audit; make release-check green through all
stages; tarball contains CHANGELOG.md and SECURITY.md.
2026-11-21 08:31:39 +00:00
lotherk 7b6f0bf7ef apex-twin 0.22.0: distcheck and the full release gate
make distcheck builds the tarball, unpacks it into mktemp -d, runs make and make
test inside it, and removes the directory via a trap. It proves the shipped
tree builds without the workspace.

make release-check runs the whole gate fail-fast:
  gate-audit -> test -> test-asan -> analyze -> fuzz -> fuzz-proxy ->
  fuzz-http -> distcheck
It takes several minutes on one core and needs the network for the example.com
checks, so it stays out of make test.

Both documented in the README with their cost. Verified: make distcheck green
(298/298 inside the tarball); make release-check green through all stages; no
temp directory left behind.
2026-11-21 08:24:01 +00:00
lotherk 9188dddfa5 apex-twin 0.21.0: a static audit that every target-taking tool is gated
tests/gate_audit.py parses every TOOLS_*[] table (45 tools, 8 tables) and the
handler bodies, with comments and string literals stripped before searching. It
enforces two rules:

  A. a tool whose schema contains a target key must call gated(), gated_cmd()
     or apex_scope_check() in its handler. Four record filters are named
     exceptions: asset_list, finding_list, report_markdown, traffic_list.
  B. a handler that opens a socket or spawns a process (http_once,
     tcp_connect_host, tcp_probe, apex_run) must call one of the same functions.

It also pins the tool count at 45, so adding a tool forces a review here. The
audit runs first in tests/run.sh, so make test = gate audit + 298 checks; there
is also a make gate-audit target.

Red proof: renaming the gate call in portscan and finding_add produced three
violations (portscan twice: target and socket; finding_add once) and exit 1.
Restored, the audit is OK.

298 checks, 45 tools, analyze clean.
2026-11-21 08:19:38 +00:00
lotherk 6b52bcc547 apex-twin 0.20.0: operations run book, security policy, release tarball
docs/operations.md is the run book: install with DESTDIR/PREFIX, the two
systemd units and their hardening, the state directory and what to back up,
scope lifecycle and rule order, proxy/rewrite/webhook operation, upgrade and
rollback, limits (8 MiB MCP body, 1 MiB proxy body/response, 1024 findings per
report) and troubleshooting by refusal reason.

SECURITY.md states the trust boundaries and the threat model: the scope file and
webhook URL are operator-owned, loopback listeners have no auth, CONNECT is a
blind tunnel, target content is data, and a missing gate is the highest severity
report. It includes a hardening checklist and the non-goals.

make dist reads APEX_VERSION from src/apex.h and writes apex-twin-<version>.tar.gz
with Makefile, README, SECURITY, .gitignore, src/, vendor/, tests/, docs/,
examples/ and systemd/; object files, gcov data, __pycache__, build dirs, the
binary and .git are excluded. 48 entries, no forbidden path.

Verified: make dist -> 0.20.0 tarball; extract to /tmp, make, full suite 298/298;
repo suite 298/298; analyze 0 warnings. README links the new docs.
2026-11-21 08:14:26 +00:00
lotherk a04b072e8f apex-twin 0.16.0: coverage pass, gap tests, graceful shutdowns
make coverage builds apex-twin-cov with -O0 --coverage, runs the suite and
prints per-file line coverage via tests/coverage.py (gcov only).

First measured pass: 55.9%. Gap tests brought it to 73.4%:
- method_techniques/playbook/tool (tools_kb.c 0 -> 100%),
- http_head, http_paths against a routed local origin, sqli_probe, xss_probe,
  curl, http_capture of a binary body and traffic_read base64 (tools_web.c
  50.4 -> 71.6%),
- banner against a raw socket, scope_reload, dns, dry-run gated_cmd
  (tools_recon.c 51.8 -> 68.0%),
- traffic_list target filter and unknown-id read (tools_traffic.c 63.6 -> 81.8%),
- marauder_cmd/scan without a device (tools_radio.c 15.2 -> 31.7%; the rest
  needs hardware, documented as a host limit).

The -O0 build also proved a real truncation warning in guard.c that -O2 did not
report: the copied scope reason is now bounded with %.240s. The proxy and the
HTTP face now handle SIGTERM/SIGINT by returning from the accept loop instead of
dying, so the last stderr line and coverage data are not lost (proxy.c 0 -> 70.9%,
rewrite.c 53.2 -> 79.9%, apex-twin.c 20.7 -> 77.2%); the HTTP child uses exit()
so gcov flushes.

Also corrected the technique count in the README: the table has 11 entries, not
12. 267 checks.
2026-11-21 07:45:03 +00:00
lotherk ed4e326ed2 apex-twin 0.15.0: fuzz the MCP HTTP front
tests/fuzz_http.py drives the sanitizer build in --http mode with raw requests:

- valid initialize, wrong path, GET, garbage request line, missing head;
- Content-Length: negative, 999999999, 100000 (with body), duplicated, absent;
- chunked body, invalid UTF-8 body, 8.5 MiB body (refused from the header),
- a head split across two writes (exercises the partial-read loop),
- 40 mutated raw requests on top.

The HTTP face forks a child per connection, so liveness is not the judge: the
child inherits stderr and any ASan/UBSan report fails the run. A case also fails
if the connection does not close within 3 s. 200/202/400/404/405/413 are all
legitimate; a sanity counter requires at least one valid 200 so a server that
rejects everything cannot pass.

make fuzz-http: 40 cases, 18 valid 200 answers, no sanitizer report, no hang.
make fuzz-http-red builds with APEX_FUZZ_BUG_HTTP (heap overflow after a
complete head) and requires rejection: 2 failures including the exact
apex-twin.c UBSan line, 'caught the deliberate bug'. Normal builds never see the
macro.

239 checks + 240 file-fuzz + 60 proxy-fuzz + 40 HTTP-fuzz cases.
2026-11-21 07:37:43 +00:00
lotherk a74aa0feaa apex-twin 0.14.0: fuzz the proxy's request parser
tests/fuzz_proxy.py starts the sanitizer proxy against a local origin and sends
mutated raw request heads in a fresh connection each time:

- seeds: absolute-URI GET, CONNECT, origin-form GET;
- 60 mutations: bit flip, truncate, duplicate/delete, invalid UTF-8/NUL, CRLF
  injection, 1k/40k/100k request lines, garbage request line;
- the client half-closes after sending, so a truncated head is EOF, not a 20 s
  read timeout. A case fails on a dead proxy, a sanitizer report, or a
  connection that never closes. 400/403/501/502 and an ECONNRESET after the
  proxy rejected unread bytes are successes. Valid requests must still get a
  200 (the run counts them), so a proxy that rejects everything cannot pass.

make fuzz-proxy: 60 cases, 23 valid 200 answers, no sanitizer report, no hang.
make fuzz-proxy-red builds the same proxy with a deliberate heap overflow in the
request path (APEX_FUZZ_BUG_PROXY) and requires the fuzzer to reject it: 3
failure lines, including the proxy.c UBSan report, 'harness caught the
deliberate bug'. Normal builds never see the macro.

239 checks + 240 file fuzz cases + 60 proxy fuzz cases.
2026-11-21 07:34:23 +00:00
lotherk 331b6da737 apex-twin 0.13.0: fuzz the scope, rewrite and MCP parsers
tests/fuzz.py is a deterministic fuzzer with no dependencies:

- seeds: examples/scope.json, the README rewrite rule, five JSON-RPC lines;
- 80 mutations each: bit flip, truncate, duplicate, delete, append invalid
  UTF-8/NUL, deep nesting, 1k-100k value;
- each case runs the ASan/UBSan binary in a fresh APEX_HOME and fails on any
  AddressSanitizer/UBSan report, a signal or a timeout. A broken scope file is
  allowed to close the gate - that is a correct answer, not a fuzz failure.

make fuzz runs 240 cases; all pass. make fuzz-selftest compiles a real
out-of-bounds program and requires the detector to flag it, so the judge is not
blind. make fuzz-red builds apex-twin-asan-bug with one deliberate heap overflow
under -DAPEX_FUZZ_BUG and fails if the fuzzer reports it green; the red run shows
three failures and 'fuzz-red PASSED: the harness caught the deliberate bug'.

No functional change in a normal build: the bug lives behind APEX_FUZZ_BUG and
the fuzz targets are separate. 239 checks + 240 fuzz cases.
2026-11-21 07:30:28 +00:00
lotherk be4e833b91 apex-twin 0.12.0: sanitizer and analyzer pass
New build targets, no new features:

  make asan       apex-twin-asan with -fsanitize=address,undefined
  make test-asan  the whole suite against it (APEX_BIN override)
  make analyze    gcc -fanalyzer over every translation unit

Results: 239/239 checks pass against the ASan/UBSan binary with no report; a
batch of error paths, network captures, report generation and evidence/traffic
reads run with LeakSanitizer on: no leaks. make analyze is clean (0 warnings).

The analyzer was red first on vendor/libmcp/mcp.h: 'b->p = realloc(b->p, want)'
loses the only pointer to the old block when realloc fails. It now grows through
a temporary and assigns after the NULL check. That is a real robustness fix, not
a suppression.

.gitignore covers apex-twin-asan and build-asan/. README documents the targets
and the result.
2026-11-21 07:26:34 +00:00
lotherk f385979be9 apex-twin 0.11.0: package the binary, the docs and the units
make install now installs four things, with DESTDIR/PREFIX respected:
  $PREFIX/bin/apex-twin
  $PREFIX/share/doc/apex-twin/README.md
  $PREFIX/lib/systemd/system/apex-twin.service
  $PREFIX/lib/systemd/system/apex-twin-proxy.service

--check and the capabilities tool report rewrite_rules and
webhook_configured (a boolean: the URL is never printed), so an operator can
see whether the proxy will rewrite and whether a critical finding will wake
anyone, without starting a server or reading the env.

Tests: --check counts two rules from a temp rewrite.json, reports the webhook
when APEX_WEBHOOK is set and keeps the URL out of its output, survives an
invalid rewrite file (0 rules, old behaviour), and capabilities returns the same
state to the model. make install DESTDIR=/tmp/apex-install-test was run by hand:
four files, modes 755/644/644/644.

45 tools, 239 checks. Red proof: hardcoding both operational fields to 0/false
turned three checks red.
2026-11-21 07:22:32 +00:00
lotherk d7bc372208 apex-twin 0.1.0: C99/POSIX offensive-security MCP server
Scope gate is the product: deny-by-default, deny beats allow, DNS answers
must stay inside allow_ip, port and radio-transmission are separate switches.
27 tools over libmcp: recon (in-process portscan, nmap, dns, tls, banner),
web (http_request, header audit, path discovery, sqli/xss leads), ESP32
Marauder serial bridge, findings with evidence, and 12 method playbooks.

56 end-to-end checks, seen red with the no-scope branch disabled.
Not yet wired into systemd or a fleet router.
2026-11-20 21:59:09 +00:00